This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin>>n;
vector<double> a(n);
vector<double> b(n);
for(int i=0;i<n;i++){
cin>>a[i]>>b[i];
}
double win=0;
for(int i=0;i<(1<<n);i++){
for(int j=0;j<(1<<n);j++){
double anz=0;
double wina=0;
double winb=0;
for(int k=0;k<n;k++){
if(i&(1<<k)){
anz++;
wina+=a[k];
}
if(j&(1<<k)){
anz++;
winb+=b[k];
}
}
double winnow=min(wina-anz, winb-anz);
win=max(win,winnow);
}
}
printf("%.4lf",(double)win);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |