# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1092141 |
2024-09-23T09:48:08 Z |
ezzzay |
Sure Bet (CEOI17_sure) |
C++14 |
|
83 ms |
3768 KB |
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
signed main(){
int n;
cin>>n;
vector<double>a,b;
for(int i=0;i<n;i++){
double x,y;
cin>>x>>y;
a.pb(x);
b.pb(y);
}
sort(a.begin(),a.end(),greater<double>());
sort(b.begin(),b.end(),greater<double>());
double ans=0,sma=0,smb=0;
int x=0,y=0;
while(min(x,y)<n){
if (x<n and (sma<smb or y==n))sma+=a[x++];
else smb+=b[y++];
ans=max(ans,min(sma,smb)-(x+y));
}
cout<<fixed<<setprecision(4)<<ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
420 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 |
420 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 |
0 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 |
420 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 |
0 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 |
76 ms |
3540 KB |
Output is correct |
18 |
Correct |
74 ms |
3516 KB |
Output is correct |
19 |
Correct |
79 ms |
3372 KB |
Output is correct |
20 |
Correct |
80 ms |
3536 KB |
Output is correct |
21 |
Correct |
83 ms |
3768 KB |
Output is correct |
22 |
Correct |
75 ms |
3520 KB |
Output is correct |
23 |
Correct |
76 ms |
3512 KB |
Output is correct |
24 |
Correct |
75 ms |
3520 KB |
Output is correct |
25 |
Correct |
75 ms |
3512 KB |
Output is correct |
26 |
Correct |
83 ms |
3724 KB |
Output is correct |