Submission #155578

# Submission time Handle Problem Language Result Execution time Memory
155578 2019-09-29T07:12:24 Z AMD Sure Bet (CEOI17_sure) C++11
0 / 100
2 ms 256 KB
#include <iostream>
#include <algorithm>
using namespace std;
int n, i, k, m, j;
double a[100001], b[100001], sa, sb, x;
int main ()
{
	cin>>n;
	for(i=0; i<n; i++)
	cin>>a[i]>>b[i];
	sort(a, a+n);
	sort(b, b+n);
	sa=a[n-1]; sb=b[n-1]; m=2; i=2; j=2;
	while(k!=1)
	{
		if(sa<sb && sa+a[n-i]-(m+1)>0 && sb-(m+1)>0)
		{sa+=a[n-i]; i++; m++;}
		else
		if(sa>sb && sb+b[n-j]-(m+1)>0 && sa-(m+1)>0)
		{sb+=b[n-j]; j++; m++;}
		else
		break;
	}
	x=min(sa, sb)-m;
	printf("%.4lf",(double)x);
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -