Submission #468680

#TimeUsernameProblemLanguageResultExecution timeMemory
468680JosiaSure Bet (CEOI17_sure)C++17
20 / 100
73 ms288 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...