# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
879270 |
2023-11-27T04:57:30 Z |
vjudge1 |
Sure Bet (CEOI17_sure) |
C++17 |
|
2000 ms |
3408 KB |
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;
using ld = long double;
const int N = 1e5 + 123;
ld a[N], b[N];
int main() {
ios_base::sync_with_stdio(0), cin.tie(0);
int n;
cin >> n;
for (int i = 1 ; i <= n ; ++ i) cin >> a[i] >> b[i];
sort(a + 1, a + 1 + n);
sort(b + 1, b + 1 + n);
reverse(a + 1, a + 1 + n);
reverse(b + 1, b + 1 + n);
for (int i = 1 ; i <= n ; ++ i) a[i] += a[i - 1], b[i] += b[i - 1];
ld ans = 0;
for (int i = 0 ; i <= n ; ++ i) {
for (int j = 0 ; j <= n ; ++ j) {
ld cur = min(a[i], b[j]) - (i + j);
ans = max(ans, cur);
}
}
cout << fixed << setprecision(4);
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2392 KB |
Output is correct |
3 |
Correct |
0 ms |
2396 KB |
Output is correct |
4 |
Correct |
0 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
0 ms |
2396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2392 KB |
Output is correct |
3 |
Correct |
0 ms |
2396 KB |
Output is correct |
4 |
Correct |
0 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
0 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
12 |
Correct |
5 ms |
2392 KB |
Output is correct |
13 |
Correct |
5 ms |
2396 KB |
Output is correct |
14 |
Correct |
6 ms |
2396 KB |
Output is correct |
15 |
Correct |
5 ms |
2540 KB |
Output is correct |
16 |
Correct |
5 ms |
2392 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2392 KB |
Output is correct |
3 |
Correct |
0 ms |
2396 KB |
Output is correct |
4 |
Correct |
0 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
0 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
12 |
Correct |
5 ms |
2392 KB |
Output is correct |
13 |
Correct |
5 ms |
2396 KB |
Output is correct |
14 |
Correct |
6 ms |
2396 KB |
Output is correct |
15 |
Correct |
5 ms |
2540 KB |
Output is correct |
16 |
Correct |
5 ms |
2392 KB |
Output is correct |
17 |
Execution timed out |
2005 ms |
3408 KB |
Time limit exceeded |
18 |
Halted |
0 ms |
0 KB |
- |