# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
881842 |
2023-12-02T03:51:37 Z |
Sharky |
Sure Bet (CEOI17_sure) |
C++17 |
|
106 ms |
3664 KB |
#include <bits/stdc++.h>
using namespace std;
using db = double;
int32_t main() {
int n;
cin >> n;
vector<db> a(n), b(n);
db ans = 0, sa = 0, sb = 0;
for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
sort(a.rbegin(), a.rend());
sort(b.rbegin(), b.rend());
int pa = 0, pb = 0;
for (int i = 1; i <= 2 * n; i++) {
if (sa <= sb && pa < n) sa += a[pa++];
else if (sb <= sa && pb < n) sb += b[pb++];
ans = max(ans, min(sa, sb) - i);
}
cout << fixed << setprecision(4) << ans << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
95 ms |
3156 KB |
Output is correct |
18 |
Correct |
95 ms |
3272 KB |
Output is correct |
19 |
Correct |
102 ms |
3128 KB |
Output is correct |
20 |
Correct |
95 ms |
3256 KB |
Output is correct |
21 |
Correct |
106 ms |
3508 KB |
Output is correct |
22 |
Correct |
94 ms |
3152 KB |
Output is correct |
23 |
Correct |
95 ms |
3128 KB |
Output is correct |
24 |
Correct |
96 ms |
3368 KB |
Output is correct |
25 |
Correct |
95 ms |
3388 KB |
Output is correct |
26 |
Correct |
106 ms |
3664 KB |
Output is correct |