# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
447452 |
2021-07-26T11:14:04 Z |
fuad27 |
Sure Bet (CEOI17_sure) |
C++14 |
|
0 ms |
204 KB |
#include<bits/stdc++.h>
using namespace std;
#define double long double
int main () {
long long n,A=0,B=0;cin>>n;
double ans=0.0,sA=0.0,sB=0.0,a[n+1],b[n+1];
for(int i=0;i<n;i++)cin>>a[i]>>b[i];
sort(a,a+n);sort(b,b+n);
reverse(a,a+n);reverse(b,b+n);
while(A<=n && B<=n) {
if(sB<sA)sB+=b[B],B++;
else sA+=a[A],A++;
ans = max(ans,min(sA-A-B,sB-A-B));
}
cout.precision(4);
cout<<fixed<<ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |