#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);
}
printf("%.4lf",(double)ans / (double)10000);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
57 ms |
348 KB |
Output is correct |
4 |
Correct |
57 ms |
348 KB |
Output is correct |
5 |
Correct |
57 ms |
348 KB |
Output is correct |
6 |
Incorrect |
58 ms |
404 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
57 ms |
348 KB |
Output is correct |
4 |
Correct |
57 ms |
348 KB |
Output is correct |
5 |
Correct |
57 ms |
348 KB |
Output is correct |
6 |
Incorrect |
58 ms |
404 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
57 ms |
348 KB |
Output is correct |
4 |
Correct |
57 ms |
348 KB |
Output is correct |
5 |
Correct |
57 ms |
348 KB |
Output is correct |
6 |
Incorrect |
58 ms |
404 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |