//author: Ahmet Alp Orakci
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
double a, b;
#define ONLINE_JUDGE
void solve() {
int n;
cin >> n;
pair <int, int> arr[n];
for(int i = 0; i < n; i++) {
cin >> a >> b;
arr[i].first = a * 100000;
arr[i].second = b * 100000;
}
int ans = 0;
for(int mask = 0; mask < (1 << n); mask++) {
for(int mmask = 0; mmask < (1 << n); mmask++) {
int fir = 0, sec = 0;
for(int i = 0; i < n; i++) {
if(mask & (1 << i)) {
if(mmask & (1 << i))
fir += arr[i].first;
else
sec += arr[i].second;
fir -= 100000;
sec -= 100000;
}
}
ans = max(ans, min(fir, sec));
}
}
printf("%.4lf", double(double(ans) / 100000));
return;
}
signed main() {
#ifndef ONLINE_JUDGE
freopen(".in", "r", stdin);
freopen(".out", "w", stdout);
#endif
int t = 1; //cin >> t;
for(int i = 1; i <= t; i++) {
solve();
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |