Submission #107928

# Submission time Handle Problem Language Result Execution time Memory
107928 2019-04-26T09:23:11 Z kingfran1907 Sure Bet (CEOI17_sure) C++14
0 / 100
4 ms 384 KB
#include <bits/stdc++.h>
#define X first
#define Y second
 
using namespace std;
const int maxn = 1e5+10;
const double inf = 10000000000000;
 
int n;
long double a[maxn], b[maxn];
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie();
 
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i] >> b[i];
 
    sort(a, a+n); reverse(a, a+n);
    sort(b, b+n); reverse(b, b+n);
 
    long double sol = 0;
    long double x = 0, y = 0;
    int ptrx = 0, ptry = 0;
    //a[n] = -inf, b[n] = -inf;
    while (ptrx < n || ptry < n) {
        //cout << "debug: " << x << " " << y << endl;
        //system("pause");
        if (x < y && ptrx < n) {
            x += a[ptrx++] - 1.0;
            y -= 1.0;
        } else {
            y += b[ptry++] - 1.0;
            x -= 1.0;
        }
        if (ptrx + ptry == 1) sol = min(x, y);
        else sol = max(sol, min(x, y));
    }
    printf("%.4lf",(double)sol);
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -