# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
51388 | 2018-06-17T18:57:20 Z | adamczh1 | Sure Bet (CEOI17_sure) | C++17 | 101 ms | 12808 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN = 1e5 + 5; int n; double a[MAXN], b[MAXN]; ll A[MAXN], B[MAXN]; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%lf %lf", &a[i], &b[i]); A[i] = round(a[i] * 10000); B[i] = round(b[i] * 10000); } sort(A, A + n); reverse(A, A + n); sort(B, B + n); reverse(B, B + n); ll lo = 0; ll hi = 1e18; while (lo < hi) { ll mid = (lo + hi + 1) / 2; ll x = 0, y = 0; int ai = 0, bi = 0; while (ai < n || bi < n) { if (x < mid && ai < n) { x += A[ai++] - 10000; y -= 10000; continue; } if (y < mid && bi < n) { x -= 10000; y += B[bi++] - 10000; continue; } break; } if (x >= mid && y >= mid) { lo = mid; } else { hi = mid - 1; } } printf("%.4lf", 0.0001 * lo); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 3 ms | 484 KB | Output is correct |
3 | Correct | 2 ms | 496 KB | Output is correct |
4 | Correct | 2 ms | 496 KB | Output is correct |
5 | Correct | 2 ms | 504 KB | Output is correct |
6 | Correct | 2 ms | 564 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 3 ms | 484 KB | Output is correct |
3 | Correct | 2 ms | 496 KB | Output is correct |
4 | Correct | 2 ms | 496 KB | Output is correct |
5 | Correct | 2 ms | 504 KB | Output is correct |
6 | Correct | 2 ms | 564 KB | Output is correct |
7 | Correct | 2 ms | 564 KB | Output is correct |
8 | Correct | 2 ms | 588 KB | Output is correct |
9 | Correct | 3 ms | 620 KB | Output is correct |
10 | Correct | 2 ms | 636 KB | Output is correct |
11 | Correct | 2 ms | 636 KB | Output is correct |
12 | Correct | 3 ms | 636 KB | Output is correct |
13 | Correct | 3 ms | 636 KB | Output is correct |
14 | Correct | 3 ms | 636 KB | Output is correct |
15 | Correct | 3 ms | 636 KB | Output is correct |
16 | Correct | 3 ms | 636 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 3 ms | 484 KB | Output is correct |
3 | Correct | 2 ms | 496 KB | Output is correct |
4 | Correct | 2 ms | 496 KB | Output is correct |
5 | Correct | 2 ms | 504 KB | Output is correct |
6 | Correct | 2 ms | 564 KB | Output is correct |
7 | Correct | 2 ms | 564 KB | Output is correct |
8 | Correct | 2 ms | 588 KB | Output is correct |
9 | Correct | 3 ms | 620 KB | Output is correct |
10 | Correct | 2 ms | 636 KB | Output is correct |
11 | Correct | 2 ms | 636 KB | Output is correct |
12 | Correct | 3 ms | 636 KB | Output is correct |
13 | Correct | 3 ms | 636 KB | Output is correct |
14 | Correct | 3 ms | 636 KB | Output is correct |
15 | Correct | 3 ms | 636 KB | Output is correct |
16 | Correct | 3 ms | 636 KB | Output is correct |
17 | Correct | 86 ms | 3664 KB | Output is correct |
18 | Correct | 88 ms | 3708 KB | Output is correct |
19 | Correct | 93 ms | 3708 KB | Output is correct |
20 | Correct | 88 ms | 3708 KB | Output is correct |
21 | Correct | 94 ms | 5504 KB | Output is correct |
22 | Correct | 96 ms | 6936 KB | Output is correct |
23 | Correct | 89 ms | 8308 KB | Output is correct |
24 | Correct | 91 ms | 9672 KB | Output is correct |
25 | Correct | 94 ms | 11056 KB | Output is correct |
26 | Correct | 101 ms | 12808 KB | Output is correct |