Submission #1092141

#TimeUsernameProblemLanguageResultExecution timeMemory
1092141ezzzaySure Bet (CEOI17_sure)C++14
100 / 100
83 ms3768 KiB
#include<bits/stdc++.h> using namespace std; #define ff first #define ss second #define pb push_back signed main(){ int n; cin>>n; vector<double>a,b; for(int i=0;i<n;i++){ double x,y; cin>>x>>y; a.pb(x); b.pb(y); } sort(a.begin(),a.end(),greater<double>()); sort(b.begin(),b.end(),greater<double>()); double ans=0,sma=0,smb=0; int x=0,y=0; while(min(x,y)<n){ if (x<n and (sma<smb or y==n))sma+=a[x++]; else smb+=b[y++]; ans=max(ans,min(sma,smb)-(x+y)); } cout<<fixed<<setprecision(4)<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...