Submission #841517

# Submission time Handle Problem Language Result Execution time Memory
841517 2023-09-01T16:12:11 Z treewave Sure Bet (CEOI17_sure) C++17
0 / 100
1 ms 344 KB
#include <bits/stdc++.h>

using namespace std;

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

    int n; cin >> n;
    vector<long long> a(n), b(n);
    for (int i = 0; i < n; i++){
        long double x, y; cin >> x >> y;
        x *= 10000; y *= 10000;
        a[i] = (long long)x; b[i] = (long long)y;
    }
    sort(a.rbegin(), a.rend());
    sort(b.rbegin(), b.rend());

    long long ans = 0, sa = 0, sb = 0, ptr_a = 0, ptr_b = 0;
    for (long long i = 1; i <= 2 * n; i++){
        if (sa < sb && ptr_a != n){
            sa += a[ptr_a];
            ptr_a++;
        }
        else{
            sb += b[ptr_b];
            ptr_b++;
        }
        ans = max(ans, min(sa, sb) - i * 10000);
    }
    printf("%.4lf\n", (ans + 0.0) / 10000);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 320 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 320 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 320 KB Output isn't correct
3 Halted 0 ms 0 KB -