Submission #52644

# Submission time Handle Problem Language Result Execution time Memory
52644 2018-06-26T10:31:48 Z snat123 Sure Bet (CEOI17_sure) C++14
0 / 100
3 ms 248 KB
#include<bits/stdc++.h>
 
using namespace std;
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    double tmp;
    long long a[n], b[n], x=0, y=0, res=0;
    for(int i=0; i<n; i++) {
    	cin >> tmp;
    	a[i]=tmp*10000;
    	cin >> tmp;
    	b[i]=tmp*10000;
    	cout << a[i] << " " << b[i] << endl;
    }
    sort(a, a+n);
	sort(b, b+n);
	int i=n-1, j=n-1;
	while(i>=0 || j>=0){
		if(x>y || i<0) y+=b[j--];
		else x+=a[i--];
		x-=10000;
		y-=10000;
		//cout << x << " " << y << endl;
		res=max(res, min(x, y));
	}
	tmp=1.0*res/10000;
	cout << fixed << setprecision(4) << tmp;
    return 0;
} 
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 248 KB Output isn't correct
2 Halted 0 ms 0 KB -