#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int n;
cin >> n;
vector <pair <ll, ll>> nums(n);
for (int i = 0; i < n; i++) {
double a, b;
cin >> a >> b;
nums[i].first = (a * 10000);
nums[i].second = (b * 10000);
}
ll ans = 0;
for (int i = 0; i < (1 << (2 * n)); i++) {
ll l = 0, r = 0;
int cnt = __builtin_popcount(i);
for (int j = 0; j < 2*n; j++) {
if (i & (1 << j)) {
if (j % 2 == 0)
l += nums[j/2].first;
else
r += nums[j/2].second;
}
}
ans = max(ans, min(l, r) - cnt * 10000);
}
cout << fixed << setprecision(4) << (double)ans / 10000 << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
74 ms |
344 KB |
Output is correct |
4 |
Correct |
72 ms |
348 KB |
Output is correct |
5 |
Correct |
58 ms |
348 KB |
Output is correct |
6 |
Incorrect |
61 ms |
348 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
74 ms |
344 KB |
Output is correct |
4 |
Correct |
72 ms |
348 KB |
Output is correct |
5 |
Correct |
58 ms |
348 KB |
Output is correct |
6 |
Incorrect |
61 ms |
348 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
74 ms |
344 KB |
Output is correct |
4 |
Correct |
72 ms |
348 KB |
Output is correct |
5 |
Correct |
58 ms |
348 KB |
Output is correct |
6 |
Incorrect |
61 ms |
348 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |