Submission #973365

# Submission time Handle Problem Language Result Execution time Memory
973365 2024-05-01T20:40:03 Z AtabayRajabli Sure Bet (CEOI17_sure) C++17
0 / 100
3 ms 2392 KB
#include <bits/stdc++.h>
#define int ll
#define all(v) v.begin(), v.end()

// author : a1abay

using namespace std;

typedef long long ll;
typedef long double ld;
const int sz = 1e5 + 5;
const int inf = 1e9 + 7;

int n;
ld a[sz], b[sz];

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    cin >> n;
    priority_queue<ld> qa, qb;
    ld l = 0, r = 0;
    for(int i = 1; i <= n; i++) 
    {
        cin >> a[i] >> b[i];
        qa.push(a[i]);
        qb.push(b[i]);
    }
    ld x = 0, ans = -inf;
    while(!qa.empty() || qb.empty())
    {
        if(l <= r && !qa.empty())
        {
            l += qa.top();
            qa.pop();
            x++;
        }
        else if(r <= l && !qb.empty())
        {
            r += qb.top();
            qb.pop();
            x++;
        }
        ans = max(ans, min(l - x, r - x));
    }
    cout << fixed << setprecision(4) << ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -