Submission #928367

#TimeUsernameProblemLanguageResultExecution timeMemory
928367AiperiiiSure Bet (CEOI17_sure)C++14
20 / 100
45 ms348 KiB
#include <bits/stdc++.h> #define int long long #define ff first #define ss second #define all(x) x.begin(),x.end() #define pb push_back using namespace std; const int N=1e5+5; signed main(){ int n; cin>>n; vector <long double> a(n),b(n); for(int i=0;i<n;i++){ cin>>a[i]>>b[i]; } long double ans=-1e9; for(int mask1=0;mask1<(1<<n);mask1++){ long double sum1=0,cnt1=0; for(int i=0;i<n;i++){ if((mask1 & (1<<i))!=0){ cnt1++; sum1+=a[i]; } } //cout<<sum1<<" "<<cnt1<<"\n"; for(int mask2=0;mask2<(1<<n);mask2++){ long double sum2=0,cnt2=0; for(int i=0;i<n;i++){ if((mask2 & (1<<i))!=0){ cnt2++; sum2+=b[i]; } } long double x=min(sum1-cnt1-cnt2,sum2-cnt1-cnt2); ans=max(ans,x); } } 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...