# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
463459 |
2021-08-11T07:48:08 Z |
vanic |
Sure Bet (CEOI17_sure) |
C++14 |
|
120 ms |
3524 KB |
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <iomanip>
using namespace std;
const int maxn=1e5+5;
double a[maxn], b[maxn];
bool cmp(double x, double y){
return x>y;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cout << fixed;
cout << setprecision(4);
int n;
cin >> n;
for(int i=0; i<n; i++){
cin >> a[i] >> b[i];
}
sort(a, a+n, cmp);
sort(b, b+n, cmp);
int ind1=0, ind2=0;
double p1=0, p2=0;
double maksi=0;
while(true){
p1--;
p2--;
if(p1<p2){
if(ind1==n){
break;
}
p1+=a[ind1];
ind1++;
}
else{
if(ind2==n){
break;
}
p2+=b[ind2];
ind2++;
}
// cout << p1 << ' ' << p2 << endl;
maksi=max(maksi, min(p1, p2));
}
cout << maksi << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
320 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
320 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
332 KB |
Output is correct |
13 |
Correct |
1 ms |
332 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
2 ms |
356 KB |
Output is correct |
16 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
320 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
332 KB |
Output is correct |
13 |
Correct |
1 ms |
332 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
2 ms |
356 KB |
Output is correct |
16 |
Correct |
1 ms |
332 KB |
Output is correct |
17 |
Correct |
94 ms |
3228 KB |
Output is correct |
18 |
Correct |
92 ms |
3216 KB |
Output is correct |
19 |
Correct |
108 ms |
3232 KB |
Output is correct |
20 |
Correct |
90 ms |
3188 KB |
Output is correct |
21 |
Correct |
120 ms |
3524 KB |
Output is correct |
22 |
Correct |
92 ms |
3232 KB |
Output is correct |
23 |
Correct |
92 ms |
3232 KB |
Output is correct |
24 |
Correct |
101 ms |
3200 KB |
Output is correct |
25 |
Correct |
91 ms |
3120 KB |
Output is correct |
26 |
Correct |
98 ms |
3512 KB |
Output is correct |