Submission #155620

# Submission time Handle Problem Language Result Execution time Memory
155620 2019-09-29T09:45:13 Z lukameladze Sure Bet (CEOI17_sure) C++14
100 / 100
254 ms 2516 KB
#include<bits/stdc++.h>
using namespace std;
int n,j,j11;
double a[100005],b[100005],l,r,ans,w;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	cin>>a[i]>>b[i];
	
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	j=n;
	j11=n;
	while(true)
	{
		w=min(l,r);
		ans=max(w,ans);
		if(l>=r)
		{
		   if(j11<1)
		   break;
		   r+=b[j11]-1;
		   j11--;
		   l--;
		}
		else
		{
			if(j<1)  break;
			l+=a[j]-1;
			j--;
			r--;	
		}
	}
	printf("%.4lf",(double)ans);
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 3 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 252 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 380 KB Output is correct
15 Correct 4 ms 504 KB Output is correct
16 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 3 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 252 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 380 KB Output is correct
15 Correct 4 ms 504 KB Output is correct
16 Correct 5 ms 376 KB Output is correct
17 Correct 193 ms 2320 KB Output is correct
18 Correct 192 ms 2352 KB Output is correct
19 Correct 194 ms 2428 KB Output is correct
20 Correct 193 ms 2472 KB Output is correct
21 Correct 228 ms 2384 KB Output is correct
22 Correct 254 ms 2432 KB Output is correct
23 Correct 191 ms 2364 KB Output is correct
24 Correct 198 ms 2372 KB Output is correct
25 Correct 192 ms 2516 KB Output is correct
26 Correct 224 ms 2472 KB Output is correct