이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define int int64_t
using namespace std;
signed main() { // they may not be all connected!!!
cin.tie(0);
ios_base::sync_with_stdio(0);
int n; cin >> n;
vector<pair<double, double>> bets(n);
for (int i = 0; i<n; i++) {
cin >> bets[i].first >> bets[i].second;
}
double res = 0;
for (int i = 0; i<(1<<(n*2)); i++) {
int totPrice = 0;
double out1 = 0;
double out2 = 0;
for (int j = 0; j<n*2; j++) {
if (i & 1<<j) {
totPrice++;
if (j<n) {
out1 += bets[j].first;
} else {
out2 += bets[j%n].second;
}
}
}
// cout << totPrice << " " << out1 << " " << out2 << "\n";
res = max(res, min(out1-totPrice, out2-totPrice));
}
printf("%.4lf\n",(double)res);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |