Submission #447430

#TimeUsernameProblemLanguageResultExecution timeMemory
447430osmanallazovSure Bet (CEOI17_sure)C++14
100 / 100
175 ms1840 KiB
#include <bits/stdc++.h> using namespace std; int main() { int t; cin>>t; double ans=0,suma=0,sumb=0; double a[t+1]; double b[t+1]; int a1=0; int b1=0; for(int i=0;i<t;i++){ cin>>a[i]; cin>>b[i]; } sort(a,a+t); reverse(a,a+t); sort(b,b+t); reverse(b,b+t); while(a1<=t && b1<=t){ if(sumb<suma){ sumb+=b[b1]; b1++; }else{ suma+=a[a1]; a1++; } ans=max(ans,min(suma-a1-b1,sumb-a1-b1)); } cout.precision(4); cout<<fixed<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...