Submission #799927

#TimeUsernameProblemLanguageResultExecution timeMemory
799927vjudge1Sure Bet (CEOI17_sure)C++17
20 / 100
1 ms340 KiB
#include<bits/stdc++.h> using namespace std; #define all(fl) fl.begin(),fl.end() #define pb push_back #define fi first #define se second #define for1(i,j,k) for(int i=j;i<=k;i++) #define for2(i,j,k) for(int i=j;i>=k;i--) #define for3(i,j,k,l) for(int i=j;i<=k;i+=l) #define lb lower_bound #define ub upper_bound #define sz(a) (int)a.size() #define pii pair<int,int> #define pli pair<long long,int> #define gcd __gcd #define lcm(x,y) x*y/__gcd(x,y) const long long mul=1e5; const int maxn=1e5+9; long long a[maxn],b[maxn]; int n; bool check(long long mid){ int p=0; for1(i,1,2*n){ long long need=1ll*i*mul+mid; for1(j,p,n){ p=j; if (a[j]>=need)break; } if (a[p]<need)return false; if (p>i)continue; if (b[i-p]>=need){ return true; } } return false; } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); //freopen("SUREBET.INP","r",stdin); //freopen("SUREBET.OUT","w",stdout); cin>>n; for1(i,1,n){ long double x,y; cin>>x>>y; x=x*mul; y=y*mul; a[i]=x,b[i]=y; } sort(a+1,a+1+n,greater<long long>()); sort(b+1,b+1+n,greater<long long>()); for1(i,1,n){ a[i]+=a[i-1]; b[i]+=b[i-1]; } long long l=0,r=1e14,ans=0; while (l<=r){ long long mid=(l+r)/2; if (check(mid)){ l=mid+1; ans=mid; } else r=mid-1; } long double realans=ans; long double realmul=mul; realans/=realmul; cout<<setprecision(4)<<fixed<<realans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...