Submission #171915

# Submission time Handle Problem Language Result Execution time Memory
171915 2019-12-30T15:39:15 Z dvdg6566 Sure Bet (CEOI17_sure) C++14
0 / 100
2 ms 256 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ld> vi;
typedef pair<ld,ld> pi;
typedef vector<pi> vpi;
typedef long double ld;
#define pb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ALL(x) x.begin(), x.end()
#define SZ(x) (ll)x.size()
#define f first
#define s second
#define MAXN 101010

vector<ld> A,B;
ld a,b;
int N;

bool work(ld v){
	ld x = v;
	ld y = v;
	int a = 0;
	int b = 0;
	while(x > 0 || y > 0){
		++x;++y;
		if (x > 0){
			if (a==SZ(A))return 0;
			x -= A[a];
			++a;
		}else if (y > 0){
			if (b==SZ(B))return 0;
			y -= B[b];
			++b;
		}
	}
	return 1;
}

int main(){
	cin>>N;
	for (int i=1;i<=N;++i){
		cin>>a>>b;
		if (a>1)A.pb(a);
		if (b>1)B.pb(b);
	}
	sort(ALL(A));reverse(ALL(A));
	sort(ALL(B));reverse(ALL(B));

	ld ub=100000000;
	ld lb=0;
	while (ub>lb+0.000001){
		ld mid=(lb+ub)/2;
		if (work(mid))lb = mid;
		else ub = mid;	
	}
	printf("%.5lf",(double)lb);
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -