Submission #43950

# Submission time Handle Problem Language Result Execution time Memory
43950 2018-03-28T13:37:41 Z sorry_Benq Sure Bet (CEOI17_sure) C++17
100 / 100
224 ms 18412 KB
#include <bits/stdc++.h>
using namespace std;

double A[100005];
double B[100005];
double X[100005];
double Y[100005];
int main(){
	int N; cin >> N; 
	for (int i = 1; i <= N; i++){
		cin >> A[i] >> B[i];
	}
	
	sort(A, A + N + 1);
	sort(B, B + N + 1);
	
	for (int i = 1; i <= N; i++){
		X[i] = X[i - 1] + (A[N - i + 1] - 1);
		Y[i] = Y[i - 1] + (B[N - i + 1] - 1);
	}
	double lo = 0;
	double hi = 1e9;
	for (int x = 0; x <= 70; x++){
		double mid = (lo + hi)/2;
		bool fnd = false;
	
		for (int i = 1; i <= N; i++){
			double y = X[i] - mid;
			int k = (int) y;
			if (k < 0){
				continue;
			}
			if (k >= N){
				k = N;
			}
			if (Y[k] - i >= mid) fnd = true;
		}
		if (!fnd) hi = mid;
		else{
			lo = mid;
		}
	}
	printf("%.4lf", lo); 
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 436 KB Output is correct
4 Correct 2 ms 548 KB Output is correct
5 Correct 2 ms 552 KB Output is correct
6 Correct 2 ms 556 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 436 KB Output is correct
4 Correct 2 ms 548 KB Output is correct
5 Correct 2 ms 552 KB Output is correct
6 Correct 2 ms 556 KB Output is correct
7 Correct 2 ms 612 KB Output is correct
8 Correct 2 ms 616 KB Output is correct
9 Correct 2 ms 620 KB Output is correct
10 Correct 2 ms 624 KB Output is correct
11 Correct 2 ms 660 KB Output is correct
12 Correct 5 ms 704 KB Output is correct
13 Correct 3 ms 916 KB Output is correct
14 Correct 4 ms 916 KB Output is correct
15 Correct 3 ms 916 KB Output is correct
16 Correct 4 ms 916 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 436 KB Output is correct
4 Correct 2 ms 548 KB Output is correct
5 Correct 2 ms 552 KB Output is correct
6 Correct 2 ms 556 KB Output is correct
7 Correct 2 ms 612 KB Output is correct
8 Correct 2 ms 616 KB Output is correct
9 Correct 2 ms 620 KB Output is correct
10 Correct 2 ms 624 KB Output is correct
11 Correct 2 ms 660 KB Output is correct
12 Correct 5 ms 704 KB Output is correct
13 Correct 3 ms 916 KB Output is correct
14 Correct 4 ms 916 KB Output is correct
15 Correct 3 ms 916 KB Output is correct
16 Correct 4 ms 916 KB Output is correct
17 Correct 176 ms 5332 KB Output is correct
18 Correct 168 ms 6672 KB Output is correct
19 Correct 170 ms 8216 KB Output is correct
20 Correct 224 ms 9516 KB Output is correct
21 Correct 197 ms 11248 KB Output is correct
22 Correct 171 ms 12620 KB Output is correct
23 Correct 172 ms 13988 KB Output is correct
24 Correct 169 ms 15384 KB Output is correct
25 Correct 169 ms 16852 KB Output is correct
26 Correct 193 ms 18412 KB Output is correct