#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 |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
59 ms |
204 KB |
Output is correct |
4 |
Correct |
57 ms |
284 KB |
Output is correct |
5 |
Correct |
56 ms |
204 KB |
Output is correct |
6 |
Correct |
63 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
59 ms |
204 KB |
Output is correct |
4 |
Correct |
57 ms |
284 KB |
Output is correct |
5 |
Correct |
56 ms |
204 KB |
Output is correct |
6 |
Correct |
63 ms |
204 KB |
Output is correct |
7 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
59 ms |
204 KB |
Output is correct |
4 |
Correct |
57 ms |
284 KB |
Output is correct |
5 |
Correct |
56 ms |
204 KB |
Output is correct |
6 |
Correct |
63 ms |
204 KB |
Output is correct |
7 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |