Submission #447422

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