Submission #1327556

#TimeUsernameProblemLanguageResultExecution timeMemory
1327556kawhietSure Bet (CEOI17_sure)C++20
20 / 100
49 ms420 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<double> a(n), b(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }
    double ans = 0;
    for (int s = 0; s < (1 << n); s++) {
        for (int t = 0; t < (1 << n); t++) {
            double x = 0, y = 0;
            int cnt = 0;
            for (int i = 0; i < n; i++) {
                if (s & (1 << i)) {
                    cnt++;
                    x += a[i];
                }
                if (t & (1 << i)) {
                    cnt++;
                    y += b[i];
                }
            }
            ans = max(ans, min(x, y) - cnt);
        }
    }
    cout << fixed << setprecision(4) << ans << '\n';
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...