| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 879313 | strelok1337 | Sure Bet (CEOI17_sure) | C++17 | 1 ms | 348 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define lld long long double
#define pb push_back
#define pf push_front
#define all(a) a.begin(),a.end()
#define IShowSpeed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int N=5e5+10;
const int mod=1e9+7;
vector<double>v1,v2;
int main()
{
    IShowSpeed
    int n;
    cin>>n;
    while(n--)
    {
        double x,y;
        cin>>x>>y;
        v1.pb(x);
        v2.pb(y);
    }
    sort(all(v1));
    sort(all(v2));
    reverse(all(v1));
    reverse(all(v2));
    for(int i=1;i<v1.size();i++) v1[i]+=v1[i-1];
    for(int i=1;i<v2.size();i++) v2[i]+=v2[i-1];
    double ans=0,cnt=1;
    for(int i=0;i<v1.size();i++,cnt++)
    {
        int l=0,r=v2.size()-1;
        while(l<=r)
        {
            int m=(l+r) >> 1;
            double lol=cnt+m+1;
            if(v2[m]>=lol && v1[i]>=lol) l=m+1,ans=max(ans,min(v2[m]-lol,v1[i]-lol));
            else r=m-1;
        }
    }
    cout<<fixed<<setprecision(4)<<ans;
}
/*
4
1.2
1.4
1.6
1.9
1.4
1.5
2
3.7
4
1.4 3.7
1.2 2
1.6 1.4
1.9 1.5
*/
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
