Submission #186111

# Submission time Handle Problem Language Result Execution time Memory
186111 2020-01-12T05:49:09 Z raghav0307 Sure Bet (CEOI17_sure) C++14
0 / 100
2 ms 376 KB
/*raghav0307 - Raghav Gupta*/

#include <bits/stdc++.h>
using namespace std;

#define ff first
#define ss second
#define pb push_back
#define fast_io() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int ll

typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;

signed main(){
	fast_io();
	int n;
	cin >> n;
	vector<ld> a;
	vector<ld> b;
	for(int i = 0; i < n; i++){
		ld x, y;
		cin >> x >> y;
		a.pb(x-1);
		b.pb(y-1);
	}
	sort(a.begin(), a.end(), greater<>());
	sort(b.begin(), b.end(), greater<>());
	ld tempA = a[0] - 1;
	ld tempB = b[0] - 1;
	ld ans = min(tempA, tempB);
	int i = 1, j = 1;
	while(i < n and j < n){
		if(tempA < tempB){
			tempB -=1 ;
			tempA += a[i];
			i++;
		}
		else{
			tempA -= 1;
			tempB += b[j];
			j++;
		}
		ans = max(ans, min(tempA, tempB));
	}
	while(i < n and tempA <= tempB){
		tempB -=1 ;
		tempA += a[i];
		i++;
		ans = max(ans, min(tempA, tempB));
	}
	while(j < n and tempB <= tempA){
		tempA -=1 ;
		tempB += b[j];
		j++;
		ans = max(ans, min(tempA, tempB));
	}
	cout << fixed << setprecision(4);
	cout << ans << "\n";
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -