Submission #720310

# Submission time Handle Problem Language Result Execution time Memory
720310 2023-04-07T23:24:07 Z thimote75 Sure Bet (CEOI17_sure) C++14
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>

using namespace std;

#define fd vector<float>

int main () {
    ios_base::sync_with_stdio(false); cin.tie(NULL);

    int n;
    cin >> n;

    fd a(n);
    fd b(n);
    for (int i = 0; i < n; i ++)
        cin >> a[i] >> b[i];
    
    sort(a.rbegin(), a.rend());
    sort(b.rbegin(), b.rend());

    int left = 0; int right = 0;
    float c = 0; float d = 0;

    float max_outcome = 0;

    while (left != n && right != n) {
        float v0 = min(c + a[left],  d) - 1;
        float v1 = min(d + b[right], c) - 1;

        c --; d --;
        if (v0 > v1) c += a[left ++];
        else d += b[right ++];

        max_outcome = max(min(c, d), max_outcome);
    }

    printf("%.4lf", (double)max_outcome);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -