| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 65777 | naderjemel | Sure Bet (CEOI17_sure) | C++14 | 101 ms | 17072 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const long long INF=2e9;
int main(){
	int n; scanf("%d",&n);
	vector<double> as,bs;
	for(int i=0;i<n;i++){
		double a,b; scanf("%lf %lf",&a,&b);
		as.push_back(a);
		bs.push_back(b);
	}
	sort(as.begin(),as.end());
	sort(bs.begin(),bs.end());
	reverse(as.begin(),as.end());
	reverse(bs.begin(),bs.end());
	int i=0,j=0;
	double rs=0.0,us=0.0;
	double nowa=0,nowb=0;
	while(i<n || j<n){
		if(i<n && j<n){
			if(nowa<=nowb && i<n){
				nowa+=as[i];
				i++; us+=1.0;
			}
			else if(j<n){
				nowb+=bs[j];
				j++; us+=1.0;
			}
		}
		else if(i<n){
			nowa+=as[i];
			i++; us+=1.0;
		}
		else{
			nowb+=bs[j];
			j++; us+=1.0;
		}
		rs=max(rs,min(nowa-us,nowb-us));
	}
	printf("%.4lf\n", (double)rs);
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
