#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
const int N = 2e6+7;
int n;
double a[N], b[N], prefixSumA[N], prefixSumB[N], res = -10000000.0;
int main()
{
cin>>n;
for(int i=1;i<=n;i++) cin>>a[i]>>b[i];
sort(a+1,a+1+n,greater<double>());
sort(b+1,b+1+n,greater<double>());
for(int i=1;i<=n;i++) {
prefixSumA[i] = prefixSumA[i-1] + a[i];
prefixSumB[i] = prefixSumB[i-1] + b[i];
}
for(int i=1;i<=2*n;i++) {
for(int j=0;j<=i;j++) {
double va1 = prefixSumA[j];
double va2 = prefixSumB[i-j];
res = max(res, min(va1 - i, va2 - i));
}
}
cout<<fixed<<setprecision(4)<<res;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |