#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()
int main(){
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int n;
cin>>n;
vector<double>a(n),b(n);
for(int i=0;i<n;i++){
cin>>a[i]>>b[i];
}
sort(rall(a));
sort(rall(b));
vector<double>sa(n+1),sb(n+1);
sa[0]=0;
sb[0]=0;
for(int i=0;i<n;i++){
sa[i+1]=sa[i]+a[i];
sb[i+1]=sb[i]+b[i];
}
double ans=0;
for(int i=0;i<=n;i++){
for(int j=0;j<=n;j++){
ans=max(ans,min(sa[i],sb[j])-i-j);
}
}
cout<<setprecision(4)<<ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |