Submission #468701

# Submission time Handle Problem Language Result Execution time Memory
468701 2021-08-29T11:59:40 Z Josia Sure Bet (CEOI17_sure) C++14
60 / 100
2000 ms 3664 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<double> bets1(n);
    vector<double> bets2(n);

    for (int i = 0; i<n; i++) {
        cin >> bets1[i] >> bets2[i];
    }


    sort (bets1.begin(), bets1.end());
    sort (bets2.begin(), bets2.end());

    reverse(bets1.begin(), bets1.end());
    reverse(bets2.begin(), bets2.end());


    vector<double> pfs1={0}, pfs2={0};

    for (int i = 0; i<n; i++) {
        pfs1.push_back(pfs1.back()+bets1[i]);
        pfs2.push_back(pfs2.back()+bets2[i]);
    }

    double res = 0;


    for (int i = 1; i<=n; i++) {
        for (int j = 1; j<=n; j++) {
            res = max(res, min(pfs1[i]-i-j, pfs2[j]-i-j));
        }
    }



    printf("%.4lf\n",(double)res);


    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 3 ms 332 KB Output is correct
13 Correct 3 ms 332 KB Output is correct
14 Correct 3 ms 332 KB Output is correct
15 Correct 3 ms 332 KB Output is correct
16 Correct 3 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 3 ms 332 KB Output is correct
13 Correct 3 ms 332 KB Output is correct
14 Correct 3 ms 332 KB Output is correct
15 Correct 3 ms 332 KB Output is correct
16 Correct 3 ms 332 KB Output is correct
17 Execution timed out 2074 ms 3664 KB Time limit exceeded
18 Halted 0 ms 0 KB -