From b41dac45a0d9793e76f4121cc4a9b1c525e94dfe Mon Sep 17 00:00:00 2001 From: Bruno Freitas Tissei <bft15@inf.ufpr.br> Date: Wed, 16 May 2018 12:31:14 +0200 Subject: [PATCH] Add gym 101492 Signed-off-by: Bruno Freitas Tissei <bft15@inf.ufpr.br> --- contests/GYM_101492/B.cpp | 43 ++++++++++++++++++++++++++++++++++++ contests/GYM_101492/F.cpp | 45 ++++++++++++++++++++++++++++++++++++++ contests/GYM_101492/a.out | Bin 0 -> 15864 bytes graph/lca.cpp | 2 +- 4 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 contests/GYM_101492/B.cpp create mode 100644 contests/GYM_101492/F.cpp create mode 100755 contests/GYM_101492/a.out diff --git a/contests/GYM_101492/B.cpp b/contests/GYM_101492/B.cpp new file mode 100644 index 0000000..8bfa667 --- /dev/null +++ b/contests/GYM_101492/B.cpp @@ -0,0 +1,43 @@ +#include <bits/stdc++.h> + +#define MAX 0 +#define MOD 1000000007 +#define EPS 1e-6 +#define inf 0x3f3f3f3f +#define llinf 0x3f3f3f3f3f3f3f3f + +#define fi first +#define se second +#define sz size() +#define pb push_back +#define ende '\n' + +#define all(x) (x).begin(), (x).end() +#define rall(x) (x).rbegin(), (x).rend() + +using namespace std; + +typedef long long ll; +typedef pair<int,int> ii; + +char ans[MAX]; + +int main() { + ios::sync_with_stdio(0); + cin.tie(0); + + ll n; cin >> n; + if (((n * (n + 1)) / 2) % 2) + return cout << -1 << ende, 0; + + ll sum = 0, h = n * (n + 1) / 4; + for (int i = n; i >= 1; --i) + if (sum + i <= h) + ans[i-1] = '+', sum += i; + else + ans[i-1] = '-'; + + ans[n] = 0; + cout << ans << ende; + return 0; +} diff --git a/contests/GYM_101492/F.cpp b/contests/GYM_101492/F.cpp new file mode 100644 index 0000000..94754f7 --- /dev/null +++ b/contests/GYM_101492/F.cpp @@ -0,0 +1,45 @@ +#include <bits/stdc++.h> + +#define MAX 0 +#define MOD 1000000007 +#define EPS 1e-6 +#define inf 0x3f3f3f3f +#define llinf 0x3f3f3f3f3f3f3f3f + +#define fi first +#define se second +#define sz size() +#define pb push_back +#define ende '\n' + +#define all(x) (x).begin(), (x).end() +#define rall(x) (x).rbegin(), (x).rend() + +using namespace std; + +typedef long long ll; +typedef pair<int,int> ii; + +int main() { + ios::sync_with_stdio(0); + cin.tie(0); + + double r, dist; + cin >> r; + int sum = 0; + + for (int i = 0; i < 3; ++i) { + double x, y; + cin >> x >> y; + dist = sqrt(x*x + y*y); + + for (int j = 10; j > 0; --j) + if (dist <= (10 - j + 1)*r + 1e-6) { + sum += j; + break; + } + } + + cout << sum << ende; + return 0; +} diff --git a/contests/GYM_101492/a.out b/contests/GYM_101492/a.out new file mode 100755 index 0000000000000000000000000000000000000000..a4b473e8015bfd52a1fb16903b06de6b96e6d49d GIT binary patch literal 15864 zcmeHOeQ;FQb-ybikYiX03|Ka}tcjgMT-I9jfv8KO6<S!O0%HUYu8kj0yHC<9tKIGH zTacKNlFD%-Q)0&Lq$K0U<YOjw$1^3JWJ)`U5y8c{<0fQE8#-~PBuzY$V^4^aQ27h> zckVl9dHb|0NT&TySF?NW`Q3BQz4zSv?tOdj(VxV+H&q1!N>a7@h$1d~lZ&)-!O2$6 zfV8VNbrZhtP|MX^@N+cgmbbeErEZ#J(?V+*uLdQ(wkj9!)8#BDR9Z;1hRe#4OF<VE zs#Hh=q(^Oy-=SI1kj@A_$L(k+8h6VHCcQnZw}<tF*0Y{a=^yotK0CPFPdiaYNhrxu z+V&GCN%{B!%}%4;F06!#-UHC1cHU^JXTj}KUj@IM<n{}dakw{S_qI0Qn@X-p+3CX2 znxVGVHLcCzd?vhB_nYjK?B=aIbxkzhY)Y3e22U83SDpI%*Z;NSThC{llLxln_RN3P zy*96xWW|QtullM0G^O2(kImnh|Li<53F*@GU9gKvA<fxn)XFmWyA|Yr5Ax;g3|5eT zq=NkKSHO=}urpKvUsb`*3do1>@u#5*^5n;mUl{y-6>u8Ga(?(Z@P(>Dg+d|ZFlMNa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++ b/graph/lca.cpp @@ -71,7 +71,7 @@ int query(int p, int q) { q = par[q][i]; } - return dp[p][0]; + return cost[p][0]; //* if (p == q) return ans; //* else return ans + cost[p][0] + cost[q][0]; -- GitLab