Submission #468680

# Submission time Handle Problem Language Result Execution time Memory
468680 2021-08-29T10:52:18 Z Josia Sure Bet (CEOI17_sure) C++17
20 / 100
73 ms 288 KB
#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
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 65 ms 204 KB Output is correct
4 Correct 65 ms 204 KB Output is correct
5 Correct 65 ms 288 KB Output is correct
6 Correct 73 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 65 ms 204 KB Output is correct
4 Correct 65 ms 204 KB Output is correct
5 Correct 65 ms 288 KB Output is correct
6 Correct 73 ms 204 KB Output is correct
7 Incorrect 1 ms 204 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 65 ms 204 KB Output is correct
4 Correct 65 ms 204 KB Output is correct
5 Correct 65 ms 288 KB Output is correct
6 Correct 73 ms 204 KB Output is correct
7 Incorrect 1 ms 204 KB Output isn't correct
8 Halted 0 ms 0 KB -