Submission #158515

# Submission time Handle Problem Language Result Execution time Memory
158515 2019-10-17T13:41:03 Z dolphingarlic Sure Bet (CEOI17_sure) C++14
100 / 100
223 ms 3744 KB
#include <bits/stdc++.h>
using namespace std;

double a[100000], b[100000];

int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
	sort(a, a + n, greater<double>());
	sort(b, b + n, greater<double>());
	
	double ans = 0, l = 0, r = 0;
	int lptr = 0, rptr = 0;
	for (int i = 1; i <= 2 * n; i++) {
		if (lptr < n && (rptr == n || l < r)) l += a[lptr++];
		else r += b[rptr++];
		ans = max(ans, min(l, r) - i);
	}
	
	cout << fixed << setprecision(4) << ans;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 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 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 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 376 KB Output is correct
14 Correct 4 ms 376 KB Output is correct
15 Correct 4 ms 376 KB Output is correct
16 Correct 4 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 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 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 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 376 KB Output is correct
14 Correct 4 ms 376 KB Output is correct
15 Correct 4 ms 376 KB Output is correct
16 Correct 4 ms 376 KB Output is correct
17 Correct 188 ms 1912 KB Output is correct
18 Correct 189 ms 1912 KB Output is correct
19 Correct 190 ms 1884 KB Output is correct
20 Correct 189 ms 1912 KB Output is correct
21 Correct 222 ms 3556 KB Output is correct
22 Correct 189 ms 3388 KB Output is correct
23 Correct 189 ms 3320 KB Output is correct
24 Correct 189 ms 3352 KB Output is correct
25 Correct 191 ms 3292 KB Output is correct
26 Correct 223 ms 3744 KB Output is correct