Submission #169695

# Submission time Handle Problem Language Result Execution time Memory
169695 2019-12-22T10:43:18 Z apostoldaniel854 Sure Bet (CEOI17_sure) C++14
0 / 100
2 ms 376 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
#define pb push_back
#define dbg(x) cerr << #x << " " << x << "\n"

const int N = 1e5;
double a[1 + N], b[1 + N];


int main () {
    ios::sync_with_stdio (false);
    cin.tie (0); cout.tie (0);
    int n;

    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> a[i] >> b[i];
    sort (a + 1, a + n + 1);
    reverse (a + 1, a + n + 1);
    sort (b + 1, b + n + 1);
    reverse (b + 1, b + n + 1);
    double suma = 0, sumb = 0;
    double ans = 0;
    int cura = 0, curb = 0;
    for (int i = 1; i <= n * 2; i++) {
        if ((suma < sumb || curb == n) && cura != n)
            suma += a[++cura];
        else
            sumb += b[++curb];
        ans = max (ans, min (suma, sumb) - i);
    }
    cout << fixed << setprecision (10) << ans << "\n";
    return 0;
}
# 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 -