# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
256664 | 2020-08-03T05:54:27 Z | ChrisT | Sure Bet (CEOI17_sure) | C++17 | 75 ms | 3576 KB |
#include<bits/stdc++.h> using namespace std; int main () { int n; scanf ("%d",&n); vector<double> a(n),b(n); for (int i = 0; i < n; i++) scanf ("%lf %lf",&a[i],&b[i]); sort(a.rbegin(),a.rend()); sort(b.rbegin(),b.rend()); int bp = 0; double ret = 0, asum = 0, bsum = 0; int cnt = 0; for (int i = 0; i < n; i++) { asum += a[i]; ++cnt; while (bp < n && min(asum,bsum + b[bp]) - 1 >= min(asum,bsum)) { bsum += b[bp++]; ++cnt; } ret = max(ret,min(asum,bsum) - cnt); } printf ("%.4f\n",ret); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 256 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 0 ms | 256 KB | Output is correct |
6 | Correct | 0 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 256 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 0 ms | 256 KB | Output is correct |
6 | Correct | 0 ms | 256 KB | Output is correct |
7 | Correct | 0 ms | 256 KB | Output is correct |
8 | Correct | 1 ms | 256 KB | Output is correct |
9 | Correct | 0 ms | 256 KB | Output is correct |
10 | Correct | 0 ms | 256 KB | Output is correct |
11 | Correct | 1 ms | 256 KB | Output is correct |
12 | Correct | 1 ms | 384 KB | Output is correct |
13 | Correct | 1 ms | 384 KB | Output is correct |
14 | Correct | 1 ms | 384 KB | Output is correct |
15 | Correct | 1 ms | 384 KB | Output is correct |
16 | Correct | 1 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 256 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 0 ms | 256 KB | Output is correct |
6 | Correct | 0 ms | 256 KB | Output is correct |
7 | Correct | 0 ms | 256 KB | Output is correct |
8 | Correct | 1 ms | 256 KB | Output is correct |
9 | Correct | 0 ms | 256 KB | Output is correct |
10 | Correct | 0 ms | 256 KB | Output is correct |
11 | Correct | 1 ms | 256 KB | Output is correct |
12 | Correct | 1 ms | 384 KB | Output is correct |
13 | Correct | 1 ms | 384 KB | Output is correct |
14 | Correct | 1 ms | 384 KB | Output is correct |
15 | Correct | 1 ms | 384 KB | Output is correct |
16 | Correct | 1 ms | 384 KB | Output is correct |
17 | Correct | 68 ms | 3320 KB | Output is correct |
18 | Correct | 68 ms | 3192 KB | Output is correct |
19 | Correct | 69 ms | 3352 KB | Output is correct |
20 | Correct | 69 ms | 3192 KB | Output is correct |
21 | Correct | 75 ms | 3576 KB | Output is correct |
22 | Correct | 66 ms | 3192 KB | Output is correct |
23 | Correct | 69 ms | 3320 KB | Output is correct |
24 | Correct | 68 ms | 3192 KB | Output is correct |
25 | Correct | 67 ms | 3212 KB | Output is correct |
26 | Correct | 72 ms | 3576 KB | Output is correct |