Submission #151724

# Submission time Handle Problem Language Result Execution time Memory
151724 2019-09-04T11:17:23 Z forestryks Sure Bet (CEOI17_sure) C++14
0 / 100
2 ms 376 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
#define rep(i, n) for (int (i) = 0; (i) < (n); ++(i))
#define all(x) (x).begin(), (x).end()
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

const int MAXN = 1e5 + 5;
int n;
ld a[MAXN];
ld b[MAXN];

int main() {
    FAST_IO;
    cout.precision(10);
    cout.setf(ios::fixed);

    cin >> n;
    rep(i, n) {
        cin >> a[i] >> b[i];
    }

    sort(a, a + n);
    sort(b, b + n);
    reverse(a, a + n);
    reverse(b, b + n);

    ld s1 = 0, s2 = 0;
    int p1 = 0, p2 = 0;
    ld res = 0;
    for (int c = 0; c < n * 2; ++c) {
        if (s1 < s2 && p1 < n) {
            s1 += a[p1++];
        } else {
            s2 += b[p2++];
        }
        res = max(res, min(s1, s2) - c - 1);
    }

    cout << res << endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -