Submission #938240

#TimeUsernameProblemLanguageResultExecution timeMemory
938240vjudge1Sure Bet (CEOI17_sure)C++17
60 / 100
2063 ms3268 KiB
#include <bits/stdc++.h> #define int long long #define ff first #define ss second #define pb push_back #define all(x) x.begin(),x.end() using namespace std; signed main(){ ios_base::sync_with_stdio(); cin.tie(0);cout.tie(0); int n; cin>>n; vector <double> a(n),b(n); for(int i=0;i<n;i++)cin>>a[i]>>b[i]; sort(all(a));sort(all(b)); reverse(all(a));reverse(all(b)); double ans=0; double sum1=0; for(int i=0;i<n;i++){ sum1+=a[i]; double sum2=0; for(int j=0;j<n;j++){ sum2+=b[j]; ans=max(ans,min(sum1-i-j-2,sum2-i-j-2)); } } cout<<fixed<<setprecision(4)<<ans<<"\n"; } /* 4 1.4 3.7 1.2 2 1.6 1.4 1.9 1.5 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...