Submission #62707

# Submission time Handle Problem Language Result Execution time Memory
62707 2018-07-29T21:22:03 Z eriksuenderhauf Sure Bet (CEOI17_sure) C++11
0 / 100
2 ms 248 KB
#include <bits/stdc++.h>
#define ni(n) scanf("%d", &n)
#define nl(n) scanf("%f", &n)
#define nai(a,n) for (int i = 0; i < (n); i++) ni((a)[i])
#define nal(a,n) for (int i = 0; i < (n); i++) nl((a)[i])
#define case(t) printf("Case #%d: ", (t))
#define pii pair<int, int>
#define vii vector<pii>
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define f first
#define s second
typedef long long ll;
const double pi = acos(-1);
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 1e5 + 5;
const double eps = 1e-9;
using namespace std;
ll a[MAXN], b[MAXN];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        double x, y;
        cin >> x >> y;
        x *= 10000;
        y *= 10000;
        a[i] = round(x);
        b[i] = round(y);
    }
    sort(a + 1, a + n + 1);
    sort(b + 1, b + n + 1);
    reverse(a + 1, a + n + 1);
    reverse(b + 1, b + n + 1);
    ll ans = 0;
    int r = 0;
    ll sa = 0, sb = 0;
    for (int l = 0; l <= n; l++)
    {
        sa += a[l];
        while (r < n && min(sa, sb + b[r + 1]) - 10000ll * (l + r + 1) > min(sa, sb) - 10000ll * (l + r))
        {
            r++;
            sb += b[r];
        }
        ans = max(min(sa, sb) - 10000ll * (l + r), ans);
    }
    long double tmp = ans / 10000.;
    cout << tmp << "\n";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -