Submission #125454

# Submission time Handle Problem Language Result Execution time Memory
125454 2019-07-05T10:48:53 Z figter001 Sure Bet (CEOI17_sure) C++17
0 / 100
2 ms 376 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
    cout << setprecision(12);
    int n;
    cin>>n;
    vector<double> o[2];
    for(int i=0;i<n;i++){
        double a,b;
        cin>>a>>b;
        o[0].push_back(a);
        o[1].push_back(b);
    }
    sort(o[0].begin(),o[0].end());
    sort(o[1].begin(),o[1].end());
    double sum[2] = {0,0},ans = 0;
    int at1 = n-1,at2 = n-1;
    while(at1 != -1 || at2 != -1){
        if(at1 == -1){
            sum[1] += o[1][at2];
            sum[1]--;
            sum[0]--;
            at2--;
        }else if(at2 == -1){
            sum[0] += o[0][at1];
            sum[0]--;
            sum[1]--;
            at1--;
        }else if(sum[0] < sum[1]){
            sum[0] += o[0][at1];
            sum[0]--;
            sum[1]--;
            at1--;
        }else{
            sum[1] += o[1][at2];
            sum[1]--;
            sum[0]--;
            at2--;
        }
        ans = max(ans,min(sum[0],sum[1]));
    }
    cout << ans << 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 -