Submission #52661

# Submission time Handle Problem Language Result Execution time Memory
52661 2018-06-26T10:47:56 Z snat123 Sure Bet (CEOI17_sure) C++14
20 / 100
3 ms 520 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-1, j=n-1;
	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-1-i)-(n-1-j));
	}
	printf("%.4lf", res);
    return 0;
} 
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 484 KB Output is correct
3 Correct 2 ms 484 KB Output is correct
4 Correct 2 ms 484 KB Output is correct
5 Correct 2 ms 484 KB Output is correct
6 Correct 2 ms 484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 484 KB Output is correct
3 Correct 2 ms 484 KB Output is correct
4 Correct 2 ms 484 KB Output is correct
5 Correct 2 ms 484 KB Output is correct
6 Correct 2 ms 484 KB Output is correct
7 Correct 2 ms 484 KB Output is correct
8 Correct 2 ms 484 KB Output is correct
9 Correct 2 ms 484 KB Output is correct
10 Correct 2 ms 484 KB Output is correct
11 Incorrect 3 ms 520 KB Output isn't correct
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 484 KB Output is correct
3 Correct 2 ms 484 KB Output is correct
4 Correct 2 ms 484 KB Output is correct
5 Correct 2 ms 484 KB Output is correct
6 Correct 2 ms 484 KB Output is correct
7 Correct 2 ms 484 KB Output is correct
8 Correct 2 ms 484 KB Output is correct
9 Correct 2 ms 484 KB Output is correct
10 Correct 2 ms 484 KB Output is correct
11 Incorrect 3 ms 520 KB Output isn't correct
12 Halted 0 ms 0 KB -