Submission #52667

# Submission time Handle Problem Language Result Execution time Memory
52667 2018-06-26T10:53:26 Z snat123 Sure Bet (CEOI17_sure) C++14
0 / 100
2 ms 488 KB
#include<bits/stdc++.h>
 
using namespace std;
 
int main(){
    int n;
    cin >> n;
    double a[n], b[n];
    for(int i=0; i<n; i++) cin >> a[i] >> b[i];
    sort(a, a+n);
	sort(b, b+n);
	int i=n, j=n;
	double x=0.0, y=0.0, res=0.0;
	while(i>=0 || j>=0){
		if(x>=y || i<0) y+=b[j--];
		else x+=a[i--];
		//x-=1;
		//y-=1;
		res=max(res, min(x, y)-(n-i)-(n-j));
	}
	printf("%.4lf", res);
    return 0;
} 
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Incorrect 2 ms 488 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Incorrect 2 ms 488 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Incorrect 2 ms 488 KB Output isn't correct
3 Halted 0 ms 0 KB -