Submission #199666

#TimeUsernameProblemLanguageResultExecution timeMemory
199666algorithm16Sure Bet (CEOI17_sure)C++14
60 / 100
188 ms5344 KiB
#include<iostream> #include<cstdio> #include<vector> #include<algorithm> using namespace std; vector <double> a; vector <double> b; int main() { int n; cin >> n; double maxi=0; for(int i=0;i<n;i++) { double x,y; cin >> x >> y; a.push_back(x); b.push_back(y); } sort(a.begin(),a.end()); sort(b.begin(),b.end()); int inda=n-2,indb=n-2; double suma=a[n-1],sumb=b[n-1]; for(int i=2;i<=n*2;i++) { maxi=max(maxi,min(suma,sumb)-i); if(suma<sumb && inda>=0) { suma+=a[inda]; inda-=1; } else { sumb+=b[indb]; indb-=1; } } printf("%.4lf",maxi); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...