#include <bits/stdc++.h>
using namespace std;
#define fd vector<float>
int main () {
ios_base::sync_with_stdio(false); cin.tie(NULL);
int n;
cin >> n;
fd a(n);
fd b(n);
for (int i = 0; i < n; i ++)
cin >> a[i] >> b[i];
sort(a.rbegin(), a.rend());
sort(b.rbegin(), b.rend());
int left = 0; int right = 0;
float c = 0; float d = 0;
float max_outcome = 0;
while (left != n && right != n) {
float v0 = min(c + a[left], d) - 1;
float v1 = min(d + b[right], c) - 1;
c --; d --;
if (v0 > v1) c += a[left ++];
else d += b[right ++];
max_outcome = max(min(c, d), max_outcome);
}
printf("%.4lf", (double)max_outcome);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |