# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
161807 | 2019-11-04T12:53:36 Z | dantoh000 | Sure Bet (CEOI17_sure) | C++14 | 76 ms | 2936 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ int n; scanf("%d",&n); int a[n], b[n]; for (int i = 0; i < n; i++){ double x,y; scanf("%lf%lf",&x,&y); x = (10000)*x + 0.1; y = (10000)*y + 0.1; a[i] = x, b[i] = y; } sort(a,a+n,greater<int>()); sort(b,b+n,greater<int>()); int ida = 0, idb = 0; ll suma = 0, sumb = 0; ll ans = 0; for (int i = 1; i <= 2*n; i++){ //printf("%d %d\n",ida,idb); if ((suma < sumb || idb == n) && ida != n){ suma += a[ida]; ida++; } else{ sumb += b[idb]; idb++; } //printf("%d %lld %lld\n",i,suma,sumb); ans = max(ans,max(0ll,min(suma,sumb)-10000ll*i)); } double actans = ((double)ans)/10000; printf("%.4f",actans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 296 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 296 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 2 ms | 256 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 256 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 3 ms | 380 KB | Output is correct |
14 | Correct | 3 ms | 380 KB | Output is correct |
15 | Correct | 3 ms | 368 KB | Output is correct |
16 | Correct | 3 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 296 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 2 ms | 256 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 256 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 3 ms | 380 KB | Output is correct |
14 | Correct | 3 ms | 380 KB | Output is correct |
15 | Correct | 3 ms | 368 KB | Output is correct |
16 | Correct | 3 ms | 376 KB | Output is correct |
17 | Correct | 72 ms | 2524 KB | Output is correct |
18 | Correct | 72 ms | 2552 KB | Output is correct |
19 | Correct | 75 ms | 2484 KB | Output is correct |
20 | Correct | 73 ms | 2552 KB | Output is correct |
21 | Correct | 75 ms | 2808 KB | Output is correct |
22 | Correct | 72 ms | 2424 KB | Output is correct |
23 | Correct | 71 ms | 2424 KB | Output is correct |
24 | Correct | 72 ms | 2424 KB | Output is correct |
25 | Correct | 73 ms | 2552 KB | Output is correct |
26 | Correct | 76 ms | 2936 KB | Output is correct |