#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main () {
int n;
cin >> n;
vector<ll> a (n), b (n);
for (int i = 0; i < n; i++) {
double x, y;
cin >> x >> y;
a[i] = round(x*10000);
b[i] = round(y*10000);
}
sort(a.rbegin(), a.rend());
sort(b.rbegin(), b.rend());
ll ans = 0;
ll cura = 0, curb = 0;
for (int i = 0, j = 0; i < n; i++) {
cura += a[i] - 10000;
curb -= 10000;
while (j < n && cura-10000 > curb+b[j]-10000) {
cura -= 10000;
curb += b[j] - 10000;
j++;
}
ans = max(ans, curb);
if (j < n) ans = max(ans, min(cura-10000, curb+b[j]-10000));
}
cout << ans/10000 << '.' << ans%10000 << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |