#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
int n, cnt1, cnt2;
double a[100001], b[100001];
double ans = -100, sum1, sum2;
main(){
cin>>n;
for(int i = 0; i < n; i++){
cin>>a[i]>>b[i];
--a[i];--b[i];
}
sort(a, a + n);
sort(b, b + n);
for(int i = n - 1; i >= 0; i--){
sum1+=a[i];cnt1++;cnt2 = 0;sum2 = 0;
for(int j = n - 1; j > n - (int)sum1 - 1; j--){
sum2+=b[j];
cnt2++;
}
ans = max(ans, min(sum1 - cnt2, sum2 - cnt1));
}
printf("%.4lf",(double)ans);
}
Compilation message
sure.cpp:8:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main(){
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |