#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
const int N = 1e5 + 10;
double a[N], b[N];
int main(int argc, char const *argv[]) {
#ifdef LOCAL_TESTING
freopen("in", "r", stdin);
#endif
int n; cin >> n;
for(int i = 1; i <= n; i++)
cin >> a[i] >> b[i];
sort(a + 1, a + n + 1, greater<double>());
sort(b + 1, b + n + 1, greater<double>());
for(int i = 1; i <= n; i++)
a[i] += a[i - 1], b[i] += b[i - 1];
double ans = 0;
for(int i = 0; i <= n; i++) {
for(int j = 0; j <= n; j++) {
ans = max(ans, min(a[i], b[j]) - i - j);
}
}
cout << fixed << setprecision(4) << ans << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
428 KB |
Output is correct |
4 |
Correct |
2 ms |
488 KB |
Output is correct |
5 |
Correct |
2 ms |
548 KB |
Output is correct |
6 |
Correct |
2 ms |
548 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
428 KB |
Output is correct |
4 |
Correct |
2 ms |
488 KB |
Output is correct |
5 |
Correct |
2 ms |
548 KB |
Output is correct |
6 |
Correct |
2 ms |
548 KB |
Output is correct |
7 |
Correct |
2 ms |
588 KB |
Output is correct |
8 |
Correct |
2 ms |
700 KB |
Output is correct |
9 |
Correct |
2 ms |
736 KB |
Output is correct |
10 |
Correct |
2 ms |
756 KB |
Output is correct |
11 |
Correct |
2 ms |
760 KB |
Output is correct |
12 |
Correct |
5 ms |
768 KB |
Output is correct |
13 |
Correct |
6 ms |
784 KB |
Output is correct |
14 |
Correct |
5 ms |
816 KB |
Output is correct |
15 |
Correct |
5 ms |
848 KB |
Output is correct |
16 |
Correct |
6 ms |
880 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
428 KB |
Output is correct |
4 |
Correct |
2 ms |
488 KB |
Output is correct |
5 |
Correct |
2 ms |
548 KB |
Output is correct |
6 |
Correct |
2 ms |
548 KB |
Output is correct |
7 |
Correct |
2 ms |
588 KB |
Output is correct |
8 |
Correct |
2 ms |
700 KB |
Output is correct |
9 |
Correct |
2 ms |
736 KB |
Output is correct |
10 |
Correct |
2 ms |
756 KB |
Output is correct |
11 |
Correct |
2 ms |
760 KB |
Output is correct |
12 |
Correct |
5 ms |
768 KB |
Output is correct |
13 |
Correct |
6 ms |
784 KB |
Output is correct |
14 |
Correct |
5 ms |
816 KB |
Output is correct |
15 |
Correct |
5 ms |
848 KB |
Output is correct |
16 |
Correct |
6 ms |
880 KB |
Output is correct |
17 |
Execution timed out |
2067 ms |
3716 KB |
Time limit exceeded |
18 |
Halted |
0 ms |
0 KB |
- |