#include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
long double tmp;
long long a[n], b[n];
for(int i=0; i<n; i++) {
cin >> tmp;
a[i]=tmp*10000;
cin >> tmp;
b[i]=tmp*10000;
}
sort(a, a+n);
sort(b, b+n);
int i=n-1, j=n-1;
long long x=0, y=0, res=0;
while(i>=0 && j>=0){
if(x>=y){
y+=b[j--];
x-=10000;
y-=10000;
res=max(res, min(x, y));
}
else{
x+=a[i--];
y-=10000;
x-=10000;
res=max(res, min(x, y));
}
}
tmp=1.0*res/10000;
cout << fixed << setprecision(4) << tmp;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Incorrect |
2 ms |
484 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 |
484 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 |
484 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |