#include <bits/stdc++.h>
using namespace std;
using ld = double;
int main() {
ios_base::sync_with_stdio(0), cin.tie(0);
int n;
cin >> n; vector<double>a(n + 1), b(n + 1);
for (int i = 1 ; i <= n ; ++ i) cin >> a[i];
for (int i = 1 ; i <= n ; ++ i) cin >> b[i];
sort(a.rbegin(), a.rend());
sort(b.rbegin(), b.rend());
for (int i = 1 ; i <= n ; ++ i) a[i] += a[i - 1], b[i] += b[i - 1];
ld ans = 0;
for (int i = 1 ; i <= n ; ++ i) {
for (int j = 1 ; j <= n ; ++ j) {
ld cur = min(a[i], b[j]) - (i + j);
ans = max(ans, cur);
}
}
cout << fixed << setprecision(4);
cout << ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |