Submission #155565

# Submission time Handle Problem Language Result Execution time Memory
155565 2019-09-29T06:43:57 Z tevdore Sure Bet (CEOI17_sure) C++14
0 / 100
2 ms 376 KB
#include<bits/stdc++.h>
using namespace std;
int n,i,k1,k2;
double q1,q2,ans,answer;
double a[1000001],b[1000001];
int main(){
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>a[i]>>b[i];
	}
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	k1=n;
	k2=n;
	while(true){
		ans=min(q1,q2);
		answer=max(ans,answer);
		if(k1 == 0 || k2 == 0)break;
		if(q1 >= q2){
		   q2+=b[k2]-1;
		   k2--;
		   q1-=1;
		   continue;
		}
		else{
			q1+=a[k1]-1;
			k1--;
			q2-=1;
		}
	}
	cout<<answer<<endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -