Submission #447444

# Submission time Handle Problem Language Result Execution time Memory
447444 2021-07-26T10:50:59 Z fuad27 Sure Bet (CEOI17_sure) C++14
0 / 100
1 ms 204 KB
#include<bits/stdc++.h>
using namespace std;
int main () {
	int n, A = 0, B = 0;cin>>n;
	long double ans = 0.0, sumA = 0.0, sumB = 0.0;
	long double a[n+1], b[n+1];
	for(int i = 0;i<n;i++){
		cin>>a[i]>>b[i];
	}
	sort(a, a+n, greater<long double> ());sort(b, b+n, greater<long double> ());
	while(A < n and B < n)
	{

		if(sumA < sumB) {
			sumA += a[A++];
		}
		else {
			sumB += b[B++];
		}
		ans = max(ans, min(sumA, sumB)	- (long double)(A) - (long double)(B));
	}
	printf("%.4lf",(double)ans);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -