Submission #882010

# Submission time Handle Problem Language Result Execution time Memory
882010 2023-12-02T12:02:32 Z Alan Sure Bet (CEOI17_sure) C++17
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main () {
	int n;
	cin >> n;
	vector<ll> a (n), b (n);
	for (int i = 0; i < n; i++) {
		double x, y;
		cin >> x >> y;
		a[i] = round(x*10000);
		b[i] = round(y*10000);
	}
	sort(a.rbegin(), a.rend());
	sort(b.rbegin(), b.rend());
	ll ans = 0;
	ll cura = 0, curb = 0;
	for (int i = 0, j = 0; i < n; i++) {
		cura += a[i] - 10000;
		curb -= 10000;
		while (j < n && cura-10000 > curb+b[j]-10000) {
			cura -= 10000;
			curb += b[j] - 10000;
			j++;
		}
		ans = max(ans, curb);
		if (j < n) ans = max(ans, min(cura-10000, curb+b[j]-10000));
	}
	cout << ans/10000 << '.' << ans%10000 << '\n';
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -