#include <bits/stdc++.h>
using namespace std;
const int mx = 1e5+5;
int n;
long double a[mx], b[mx];
long double ans = 0;
int main() {
cin.tie(0);ios::sync_with_stdio(0);
cin >> n;
for (int i=0;i<n;i++) {
cin >> a[i] >> b[i];
}
sort(a, a+n); reverse(a, a+n);
sort(b, b+n); reverse(b, b+n);
long double sa = 0;
for (int i=0;i<n;i++) {
sa += a[i];
long double sb = 0;
for (int j=0;j<n;j++) {
sb += b[j];
ans = max(ans, min(sa - i - j - 2, sb - i - j - 2));
}
}
cout << fixed << setprecision(4) << ans << "\n";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2648 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2392 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2648 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2392 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
1 ms |
2392 KB |
Output is correct |
12 |
Correct |
6 ms |
2392 KB |
Output is correct |
13 |
Correct |
6 ms |
2396 KB |
Output is correct |
14 |
Correct |
6 ms |
2552 KB |
Output is correct |
15 |
Correct |
6 ms |
2396 KB |
Output is correct |
16 |
Correct |
6 ms |
2396 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2648 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2392 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
1 ms |
2392 KB |
Output is correct |
12 |
Correct |
6 ms |
2392 KB |
Output is correct |
13 |
Correct |
6 ms |
2396 KB |
Output is correct |
14 |
Correct |
6 ms |
2552 KB |
Output is correct |
15 |
Correct |
6 ms |
2396 KB |
Output is correct |
16 |
Correct |
6 ms |
2396 KB |
Output is correct |
17 |
Execution timed out |
2012 ms |
4856 KB |
Time limit exceeded |
18 |
Halted |
0 ms |
0 KB |
- |