| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 1157187 | SmuggingSpun | Sure Bet (CEOI17_sure) | C++20 | 0 ms | 528 KiB | 
#include<bits/stdc++.h>
#define taskname "B"
using namespace std;
typedef long long ll;
const int lim = 1e5 + 5;
int n;
ll a[lim], b[lim];
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	if(fopen(taskname".inp", "r")){
		freopen(taskname".inp", "r", stdin);
	}
	cin >> n;
	for(int i = 1; i <= n; i++){
		double A, B;
		cin >> A >> B;
		a[i] = ll(A * 1e4);
		b[i] = ll(B * 1e4);
	}
	sort(a + 1, a + n + 1, greater<ll>());
	sort(b + 1, b + n + 1, greater<ll>());
	a[0] = b[0] = 0;
	for(int i = 1; i <= n; i++){
		a[i] += a[i - 1];
		b[i] += b[i - 1];
	}
	ll low = 1, high = 1e13, ans = 0;
	while(low <= high){
		ll mid = (low + high) >> 1LL;
		bool can = false;
		for(int i = 1; i <= (n << 1); i++){
			if(min(a[n], b[n]) < mid + i * 10000){
				break;
			}
			if((lower_bound(a + 1, a + n + 1, mid + i * 10000) - a) + (lower_bound(b + 1, b + n + 1, mid + i * 10000) - b) <= i){
				can = true;
				break;
			}
		}
		if(can){
			low = (ans = mid) + 1;
		}
		else{
			high = mid - 1;
		}
	}
	cout << setprecision(4) << fixed << double(ans) / 1e4;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
