# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
595074 |
2022-07-13T10:32:31 Z |
1bin |
Sure Bet (CEOI17_sure) |
C++14 |
|
91 ms |
3788 KB |
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
typedef long long ll;
const int NMAX = 1e5 + 5;
int n, ix;
double a[NMAX], b[NMAX], ans, x, y;
int main(void){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed; cout.precision(4);
cin >> n;
for(int i = 0; i < n; i++) cin >> a[i] >> b[i], a[i] -= 1, b[i] -= 1;
sort(a, a + n); reverse(a, a + n);
sort(b, b + n); reverse(b, b + n);
ix = -1;
for(int i = 0; i < n; i++){
x += a[i]; y -= 1;
while(ix + 1 < n && min(x, y) <= min(x - 1, y + b[ix + 1])){
y += b[++ix]; x -= 1;
}
ans = max(ans, min(x, y));
}
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
324 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
2 ms |
360 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
324 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
2 ms |
360 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
74 ms |
3184 KB |
Output is correct |
18 |
Correct |
73 ms |
3236 KB |
Output is correct |
19 |
Correct |
68 ms |
3120 KB |
Output is correct |
20 |
Correct |
73 ms |
3244 KB |
Output is correct |
21 |
Correct |
76 ms |
3608 KB |
Output is correct |
22 |
Correct |
78 ms |
3148 KB |
Output is correct |
23 |
Correct |
91 ms |
3172 KB |
Output is correct |
24 |
Correct |
81 ms |
3148 KB |
Output is correct |
25 |
Correct |
70 ms |
3128 KB |
Output is correct |
26 |
Correct |
81 ms |
3788 KB |
Output is correct |