#include<bits/stdc++.h>
using namespace std;
int main () {
int n;cin>>n;
long double ans = 0.0;
long double a[n], b[n];
for(int i = 0;i<n;i++){
cin>>a[i]>>b[i];
}
sort(a, a+n, greater<long double> () );sort(b, b+n, greater<long double> ());
for(int i = 1;i<n;i++)a[i]+=a[i-1],b[i]+=b[i-1];
for(int i=0;i<n;i++)
{
for(int j = 0;j<n;j++){
ans=max(ans, min(a[i], b[j]) - i - j - 2);
}
}cout<<fixed<<setprecision(4)<<ans<<endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
292 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
8 ms |
344 KB |
Output is correct |
13 |
Correct |
8 ms |
332 KB |
Output is correct |
14 |
Correct |
8 ms |
332 KB |
Output is correct |
15 |
Correct |
8 ms |
340 KB |
Output is correct |
16 |
Correct |
9 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
292 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
8 ms |
344 KB |
Output is correct |
13 |
Correct |
8 ms |
332 KB |
Output is correct |
14 |
Correct |
8 ms |
332 KB |
Output is correct |
15 |
Correct |
8 ms |
340 KB |
Output is correct |
16 |
Correct |
9 ms |
332 KB |
Output is correct |
17 |
Execution timed out |
2084 ms |
4668 KB |
Time limit exceeded |
18 |
Halted |
0 ms |
0 KB |
- |