# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
160257 | 2019-10-26T13:54:15 Z | Akashi | Sure Bet (CEOI17_sure) | C++14 | 112 ms | 3704 KB |
#include <bits/stdc++.h> using namespace std; int n; double a[100005], b[100005]; int main() { // freopen("1.in", "r", stdin); scanf("%d", &n); for(int i = 1; i <= n ; ++i) scanf("%lf %lf", &a[i], &b[i]); sort(a + 1, a + n + 1); sort(b + 1, b + n + 1); double st = 0, dr = 1e9; int pasi = 69; while(pasi--){ double mij = (st + dr) / 2; int i = n, j = n, cost = 0; double sum1 = 0, sum2 = 0; while(i >= 0 && j >= 0){ if(sum1 - cost >= mij && sum2 - cost >= mij) break ; if(sum1 - cost < mij){ ++cost; sum1 += a[i--]; } else{ ++cost; sum2 += b[j--]; } } if(sum1 - cost < mij || sum2 - cost < mij) dr = mij; else st = mij; } printf("%.4f", st); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 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 | 376 KB | Output is correct |
12 | Correct | 3 ms | 376 KB | Output is correct |
13 | Correct | 3 ms | 376 KB | Output is correct |
14 | Correct | 3 ms | 416 KB | Output is correct |
15 | Correct | 3 ms | 376 KB | Output is correct |
16 | Correct | 4 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 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 | 376 KB | Output is correct |
12 | Correct | 3 ms | 376 KB | Output is correct |
13 | Correct | 3 ms | 376 KB | Output is correct |
14 | Correct | 3 ms | 416 KB | Output is correct |
15 | Correct | 3 ms | 376 KB | Output is correct |
16 | Correct | 4 ms | 376 KB | Output is correct |
17 | Correct | 95 ms | 3300 KB | Output is correct |
18 | Correct | 99 ms | 3304 KB | Output is correct |
19 | Correct | 104 ms | 3192 KB | Output is correct |
20 | Correct | 99 ms | 3336 KB | Output is correct |
21 | Correct | 112 ms | 3704 KB | Output is correct |
22 | Correct | 95 ms | 3320 KB | Output is correct |
23 | Correct | 96 ms | 3452 KB | Output is correct |
24 | Correct | 103 ms | 3324 KB | Output is correct |
25 | Correct | 98 ms | 3192 KB | Output is correct |
26 | Correct | 110 ms | 3704 KB | Output is correct |