#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = a; i<int(b);++i)
#define all(v) v.begin(),v.end()
#define sz(v) v.size()
#define trav(a,c) for(auto a: c)
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pii;
ll n;
vector<double> a;
vector<double> b;
double best = 0;
void getBest(ll index, double sumA, double sumB){
if(index==n){
best = max(best,min(sumA,sumB));
return;
}
getBest(index+1,sumA+a[index]-1,sumB-1);
getBest(index+1,sumA-1,sumB+b[index]-1);
getBest(index+1,sumA,sumB);
}
int main(){
cin.sync_with_stdio(false);
cin>>n;
a.resize(n);
b.resize(n);
rep(i,0,n) cin>>a[i]>>b[i];
getBest(0,0,0);
printf("%.4lf",(double)best);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |