# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
882011 |
2023-12-02T12:04:01 Z |
Alan |
Sure Bet (CEOI17_sure) |
C++17 |
|
103 ms |
3672 KB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main () {
int n;
cin >> n;
vector<ll> a (n), b (n);
for (int i = 0; i < n; i++) {
double x, y;
cin >> x >> y;
a[i] = round(x*10000);
b[i] = round(y*10000);
}
sort(a.rbegin(), a.rend());
sort(b.rbegin(), b.rend());
ll ans = 0;
ll cura = 0, curb = 0;
for (int i = 0, j = 0; i < n; i++) {
cura += a[i] - 10000;
curb -= 10000;
while (j < n && cura-10000 > curb+b[j]-10000) {
cura -= 10000;
curb += b[j] - 10000;
j++;
}
ans = max(ans, curb);
if (j < n) ans = max(ans, min(cura-10000, curb+b[j]-10000));
}
printf("%.4lf", (double) ans/10000);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
440 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
440 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
348 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 |
440 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
2 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
452 KB |
Output is correct |
16 |
Correct |
2 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
440 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
348 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 |
440 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
2 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
452 KB |
Output is correct |
16 |
Correct |
2 ms |
348 KB |
Output is correct |
17 |
Correct |
92 ms |
3364 KB |
Output is correct |
18 |
Correct |
92 ms |
3256 KB |
Output is correct |
19 |
Correct |
102 ms |
3156 KB |
Output is correct |
20 |
Correct |
92 ms |
3276 KB |
Output is correct |
21 |
Correct |
103 ms |
3664 KB |
Output is correct |
22 |
Correct |
91 ms |
3152 KB |
Output is correct |
23 |
Correct |
91 ms |
3272 KB |
Output is correct |
24 |
Correct |
92 ms |
3156 KB |
Output is correct |
25 |
Correct |
100 ms |
3156 KB |
Output is correct |
26 |
Correct |
102 ms |
3672 KB |
Output is correct |