# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
52698 |
2018-06-26T11:29:14 Z |
snat123 |
Sure Bet (CEOI17_sure) |
C++14 |
|
4 ms |
768 KB |
#include<bits/stdc++.h>
using namespace std;
long double a[100001], b[100001];
int main(){
int n;
cin >> n;
for(int i=0; i<n; i++) cin >> a[i] >> b[i];
sort(a, a+n);
sort(b, b+n);
int i=n-1, j=n-1;
long double x=0.0, y=0.0, res=0.0;
while(i>=0 || j>=0){
if(i<0 || x>y) y+=b[j--];
else if(i>=0 )x+=a[i--];
else break;
res=max(res, min(x, y)-(n-i)-(n-j)+2);
}
cout << fixed << setprecision(4) << res;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
420 KB |
Output is correct |
2 |
Correct |
4 ms |
464 KB |
Output is correct |
3 |
Correct |
3 ms |
552 KB |
Output is correct |
4 |
Correct |
2 ms |
552 KB |
Output is correct |
5 |
Correct |
2 ms |
552 KB |
Output is correct |
6 |
Incorrect |
2 ms |
768 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
420 KB |
Output is correct |
2 |
Correct |
4 ms |
464 KB |
Output is correct |
3 |
Correct |
3 ms |
552 KB |
Output is correct |
4 |
Correct |
2 ms |
552 KB |
Output is correct |
5 |
Correct |
2 ms |
552 KB |
Output is correct |
6 |
Incorrect |
2 ms |
768 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
420 KB |
Output is correct |
2 |
Correct |
4 ms |
464 KB |
Output is correct |
3 |
Correct |
3 ms |
552 KB |
Output is correct |
4 |
Correct |
2 ms |
552 KB |
Output is correct |
5 |
Correct |
2 ms |
552 KB |
Output is correct |
6 |
Incorrect |
2 ms |
768 KB |
Output isn't correct |