답안 #171918

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
171918 2019-12-30T15:42:18 Z dvdg6566 Sure Bet (CEOI17_sure) C++14
100 / 100
288 ms 5600 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("%.4lf",(double)(lb));
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 252 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 252 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 252 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 252 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 276 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 4 ms 376 KB Output is correct
13 Correct 4 ms 380 KB Output is correct
14 Correct 4 ms 312 KB Output is correct
15 Correct 4 ms 376 KB Output is correct
16 Correct 5 ms 380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 252 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 252 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 276 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 4 ms 376 KB Output is correct
13 Correct 4 ms 380 KB Output is correct
14 Correct 4 ms 312 KB Output is correct
15 Correct 4 ms 376 KB Output is correct
16 Correct 5 ms 380 KB Output is correct
17 Correct 234 ms 5040 KB Output is correct
18 Correct 240 ms 5080 KB Output is correct
19 Correct 246 ms 5060 KB Output is correct
20 Correct 245 ms 5104 KB Output is correct
21 Correct 288 ms 5532 KB Output is correct
22 Correct 256 ms 5272 KB Output is correct
23 Correct 242 ms 5052 KB Output is correct
24 Correct 245 ms 5256 KB Output is correct
25 Correct 237 ms 5076 KB Output is correct
26 Correct 281 ms 5600 KB Output is correct