# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
841816 |
2023-09-02T06:54:52 Z |
WLZ |
Sure Bet (CEOI17_sure) |
C++17 |
|
70 ms |
2244 KB |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<double> v_a, v_b;
for (int i = 0; i < n; i++) {
double a, b;
cin >> a >> b;
v_a.push_back(a);
v_b.push_back(b);
}
sort(v_a.rbegin(), v_a.rend());
sort(v_b.rbegin(), v_b.rend());
double a = 0.0, b = 0.0, ans = 0.0;
for (int x = 0, y = 0; x <= n; x++) {
if (x > 0) a += v_a[x - 1] - 1, b -= 1.0;
while (y < n && a - b > 1e-7) {
ans = max(ans, min(a, b));
b += v_b[y++] - 1, a -= 1.0;
}
ans = max(ans, min(a, b));
}
cout << fixed << setprecision(4) << ans << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 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 |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 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 |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 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 |
1 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 |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 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 |
57 ms |
1988 KB |
Output is correct |
18 |
Correct |
70 ms |
2224 KB |
Output is correct |
19 |
Correct |
61 ms |
2052 KB |
Output is correct |
20 |
Correct |
60 ms |
2088 KB |
Output is correct |
21 |
Correct |
60 ms |
1988 KB |
Output is correct |
22 |
Correct |
56 ms |
2000 KB |
Output is correct |
23 |
Correct |
61 ms |
2244 KB |
Output is correct |
24 |
Correct |
58 ms |
1988 KB |
Output is correct |
25 |
Correct |
59 ms |
2212 KB |
Output is correct |
26 |
Correct |
60 ms |
2232 KB |
Output is correct |