#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define dbg(x) cerr << #x << " " << x << "\n"
const int N = 1e5;
double a[1 + N], b[1 + N];
int main () {
ios::sync_with_stdio (false);
cin.tie (0); cout.tie (0);
int n;
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i] >> b[i];
sort (a + 1, a + n + 1);
reverse (a + 1, a + n + 1);
sort (b + 1, b + n + 1);
reverse (b + 1, b + n + 1);
double suma = 0, sumb = 0;
double ans = 0;
int cura = 0, curb = 0;
for (int i = 1; i <= n * 2; i++) {
if ((suma < sumb || curb == n) && cura != n)
suma += a[++cura];
else
sumb += b[++curb];
ans = max (ans, min (suma, sumb) - i);
}
cout << fixed << setprecision (10) << ans << "\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |