Submission #51810

#TimeUsernameProblemLanguageResultExecution timeMemory
51810istleminSure Bet (CEOI17_sure)C++14
0 / 100
2 ms376 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...