Submission #52641

# Submission time Handle Problem Language Result Execution time Memory
52641 2018-06-26T10:30:51 Z snat123 Sure Bet (CEOI17_sure) C++14
0 / 100
3 ms 572 KB
#include<bits/stdc++.h>
 
using namespace std;
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    long 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;
	long double x=0, y=0, res=0.0;
	while(i>=0 || j>=0){
		if(x>=y || i<0){
			y+=b[j--];
			x-=1;
			y-=1;
			res=max(res, min(x, y));
			
		}
		else{
			x+=a[i--];
			y-=1;
			x-=1;
			res=max(res, min(x, y));
		}
	}
	cout << fixed << setprecision(4) << res;
    return 0;
} 
# Verdict Execution time Memory Grader output
1 Correct 3 ms 252 KB Output is correct
2 Correct 3 ms 356 KB Output is correct
3 Correct 2 ms 408 KB Output is correct
4 Correct 2 ms 520 KB Output is correct
5 Correct 2 ms 572 KB Output is correct
6 Incorrect 3 ms 572 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 252 KB Output is correct
2 Correct 3 ms 356 KB Output is correct
3 Correct 2 ms 408 KB Output is correct
4 Correct 2 ms 520 KB Output is correct
5 Correct 2 ms 572 KB Output is correct
6 Incorrect 3 ms 572 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 252 KB Output is correct
2 Correct 3 ms 356 KB Output is correct
3 Correct 2 ms 408 KB Output is correct
4 Correct 2 ms 520 KB Output is correct
5 Correct 2 ms 572 KB Output is correct
6 Incorrect 3 ms 572 KB Output isn't correct