답안 #155574

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
155574 2019-09-29T06:59:37 Z lukameladze Sure Bet (CEOI17_sure) C++14
0 / 100
2 ms 256 KB
#include <bits/stdc++.h>
using namespace std;
double a[100005],b[100005],k,l,r,k1,ans;
int n,fs;
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);
	for (int i=n; i>=1; i--)
	{
		
		if (k+a[i]>l)
		{
			k+=a[i];
			l=k;
			fs++;
		}
		
			ans=max(ans,min(l-fs,r-fs));
		
		if (k1+b[i]>r)
		{
			k1+=b[i];
			r=k1;
			fs++;
		}
		ans=max(ans,min(l-fs,r-fs));
	}
	 printf("%.4lf",(double)ans);



}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Incorrect 2 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Incorrect 2 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Incorrect 2 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -