Submission #51814

# Submission time Handle Problem Language Result Execution time Memory
51814 2018-06-21T09:12:36 Z istlemin Sure Bet (CEOI17_sure) C++14
20 / 100
2000 ms 556 KB
#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]-2,sumB+b[index]-2);
	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 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 8 ms 536 KB Output is correct
4 Correct 8 ms 556 KB Output is correct
5 Correct 8 ms 556 KB Output is correct
6 Correct 8 ms 556 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 8 ms 536 KB Output is correct
4 Correct 8 ms 556 KB Output is correct
5 Correct 8 ms 556 KB Output is correct
6 Correct 8 ms 556 KB Output is correct
7 Execution timed out 2076 ms 556 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 8 ms 536 KB Output is correct
4 Correct 8 ms 556 KB Output is correct
5 Correct 8 ms 556 KB Output is correct
6 Correct 8 ms 556 KB Output is correct
7 Execution timed out 2076 ms 556 KB Time limit exceeded
8 Halted 0 ms 0 KB -