Submission #51700

# Submission time Handle Problem Language Result Execution time Memory
51700 2018-06-20T06:24:20 Z tmwilliamlin168 Sure Bet (CEOI17_sure) C++14
100 / 100
112 ms 4104 KB
#include <bits/stdc++.h>
using namespace std;

const int mxN=1e5;
int n;
double a[mxN+1], b[mxN+1], ans, sa, sb;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	for(int i=0; i<n; ++i)
		cin >> a[i] >> b[i];
	sort(a, a+n+1);
	sort(b, b+n+1);
	for(int i1=n, i2=n; i1>=0&&i2>=0; ) {
		if(sa<sb)
			sa+=a[i1--];
		else
			sb+=b[i2--];
		ans=max(min(sa, sb)-(n-i1)-(n-i2), ans);
	}
	cout << fixed << setprecision(4) << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 436 KB Output is correct
4 Correct 2 ms 644 KB Output is correct
5 Correct 2 ms 652 KB Output is correct
6 Correct 3 ms 652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 436 KB Output is correct
4 Correct 2 ms 644 KB Output is correct
5 Correct 2 ms 652 KB Output is correct
6 Correct 3 ms 652 KB Output is correct
7 Correct 3 ms 652 KB Output is correct
8 Correct 7 ms 720 KB Output is correct
9 Correct 2 ms 720 KB Output is correct
10 Correct 3 ms 720 KB Output is correct
11 Correct 2 ms 720 KB Output is correct
12 Correct 4 ms 720 KB Output is correct
13 Correct 3 ms 720 KB Output is correct
14 Correct 4 ms 720 KB Output is correct
15 Correct 4 ms 720 KB Output is correct
16 Correct 4 ms 720 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 436 KB Output is correct
4 Correct 2 ms 644 KB Output is correct
5 Correct 2 ms 652 KB Output is correct
6 Correct 3 ms 652 KB Output is correct
7 Correct 3 ms 652 KB Output is correct
8 Correct 7 ms 720 KB Output is correct
9 Correct 2 ms 720 KB Output is correct
10 Correct 3 ms 720 KB Output is correct
11 Correct 2 ms 720 KB Output is correct
12 Correct 4 ms 720 KB Output is correct
13 Correct 3 ms 720 KB Output is correct
14 Correct 4 ms 720 KB Output is correct
15 Correct 4 ms 720 KB Output is correct
16 Correct 4 ms 720 KB Output is correct
17 Correct 105 ms 3016 KB Output is correct
18 Correct 108 ms 3060 KB Output is correct
19 Correct 103 ms 3060 KB Output is correct
20 Correct 112 ms 3060 KB Output is correct
21 Correct 108 ms 4104 KB Output is correct
22 Correct 100 ms 4104 KB Output is correct
23 Correct 105 ms 4104 KB Output is correct
24 Correct 103 ms 4104 KB Output is correct
25 Correct 101 ms 4104 KB Output is correct
26 Correct 108 ms 4104 KB Output is correct