#include <bits/stdc++.h>
#define loop(i, a, b) for(int i=a;i<b;i++)
#define cc(a) cout<< a << endl;
using namespace std;
int main() {
int n; cin >> n;
vector<double> arr, brr;arr.resize(n),brr.resize(n);
loop(i, 0, n) cin >> arr[i]>>brr[i];
sort(arr.begin(), arr.end(), greater<double>());
sort(brr.begin(), brr.end(), greater<double>());
loop(i, 1, n) arr[i]+=arr[i-1];
loop(i, 1, n) brr[i]+=brr[i-1];
double ans=0;
loop(i, 0, n) ans=max(ans, arr[i]-2-i-(lower_bound(brr.begin(), brr.end(), arr[i])-brr.begin()));
loop(i, 0, n) ans=max(ans, brr[i]-2-i-(lower_bound(arr.begin(), arr.end(), brr[i])-arr.begin()));
printf("%.4lf", ans);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |