Submission #1126036

#TimeUsernameProblemLanguageResultExecution timeMemory
1126036nikolashamiSure Bet (CEOI17_sure)C++20
100 / 100
61 ms1864 KiB
#include <bits/stdc++.h> using namespace std; const int N=1e5+4; double a[N],b[N]; signed main(){ ios::sync_with_stdio(0); cin.tie(0); int n; cin>>n; for(int i=0;i<n;++i){ cin>>a[i]>>b[i]; } sort(a,a+n,greater<double>()); sort(b,b+n,greater<double>()); double si=0,sj=0,ans=0; int i=0,j=0; for(int k=1;k<=2*n;++k){ if((si<sj||j>=n)&&i<n)si+=a[i++]; else sj+=b[j++]; double x=min(si,sj)-(1.0*k); ans=max(ans,x); } printf("%.4lf",(double)ans); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...