Submission #155564

# Submission time Handle Problem Language Result Execution time Memory
155564 2019-09-29T06:41:57 Z keta_tsimakuridze Sure Bet (CEOI17_sure) C++14
0 / 100
2 ms 256 KB
#include<bits/stdc++.h>
using namespace std;
int n,k,j;
double a[100005],b[100005],sum1,s1,sum2,ans;
 int main(){
	cin>>n;
	for(k=1;k<=n;k++){
		cin>>a[k]>>b[k];
		
		
	}
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	j=n;
	for(k=n;k>=1;k--){
		sum1+=a[k]-1;
		sum2--;
		while(sum2<sum1 && j>=1){
		sum1-=1;	sum2+=b[j]-1;
			ans=max(ans,min(sum1,sum2));
			
			j--;
		}
		
		
	} sum1=sum2=s1=0; j=n;
		for(k=n;k>=1;k--){
		sum1+=b[k]-1;
		sum2--; cout<<sum2<<" "<<endl;
		while(sum2<sum1 && j>=1){
		sum1-=1;	sum2+=a[j]-1;
			ans=max(ans,min(sum1,sum2));
		
			j--;
		}
		
		
	}
	 printf("%.4lf",(double)ans);
}
# 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 -