# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
49317 |
2018-05-25T16:42:36 Z |
robert |
Sure Bet (CEOI17_sure) |
C++14 |
|
3 ms |
488 KB |
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
string padding(int n, int l, char c){
string res = "";
int nm = pow(10, l);
while(nm>n){
n *=10;
res += c;
}
return res;
}
int main(){
int N; cin>>N;
int a[100100], b[100100];
int sc = 10000;
double f, s;
for(int n=0; n<N; n++){
cin>>f>>s;
a[n] = f*10000;
b[n] = s*10000;
}
sort(a, a+N);
sort(b, b+N);
int ans = 0;
int l = N-2, r = N-2;
int lo = a[N-1], ro = b[N-1];
int bt = 2;
while(l>=0||r>=0){
ans = max(ans, min(lo, ro)-bt*sc);
if(lo<ro){
if(l>=0){
lo += a[l--];
bt++;
} else {
break;
}
} else {
if(r>=0){
ro += b[r--];
bt++;
} else {
break;
}
}
ans = max(ans, min(lo, ro)-bt*sc);
}
double dans = ans;
printf("%.4f\n", dans/((double)sc));
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
248 KB |
Output is correct |
2 |
Incorrect |
2 ms |
488 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
248 KB |
Output is correct |
2 |
Incorrect |
2 ms |
488 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
248 KB |
Output is correct |
2 |
Incorrect |
2 ms |
488 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |