#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
double a[n], b[n];
for(int i=0; i<n; i++) cin >> a[i] >> b[i];
sort(a, a+n);
sort(b, b+n);
int i=n, j=n;
double x=0.0, y=0.0, res=0.0;
while(i>=0 || j>=0){
if(x>=y || i<0) y+=b[j--];
else x+=a[i--];
//x-=1;
//y-=1;
res=max(res, min(x, y)-(n-i)-(n-j));
}
printf("%.4lf", res);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Incorrect |
2 ms |
488 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Incorrect |
2 ms |
488 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Incorrect |
2 ms |
488 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |