제출 #1349300

#제출 시각아이디문제언어결과실행 시간메모리
1349300khanhphucscratchSure Bet (CEOI17_sure)C++20
0 / 100
0 ms344 KiB
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n; cin>>n;
    vector<int> a, b;
    for(int i = 1; i <= n; i++){
        double x, y; cin>>x>>y;
        a.push_back(x*10000); b.push_back(y*10000);
    }
    sort(a.begin(), a.end()); sort(b.begin(), b.end());
    int ans = 0, x = 0, y = 0;
    if(a.back() > b.back()) swap(a, b);
    for(int i = 1; i <= 2*n; i++){
        if(x < y && a.size() > 0){
            x += a.back(); a.pop_back();
        }
        else{
            y += b.back(); b.pop_back();
        }
        ans = max(ans, min(x, y) - i*10000);
    }
    cout<<setprecision(4)<<fixed<<(double)ans/10000;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...