Submission #693406

# Submission time Handle Problem Language Result Execution time Memory
693406 2023-02-03T02:28:29 Z TriangleBicycle Sure Bet (CEOI17_sure) C++17
0 / 100
1 ms 212 KB
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using graph = vector<vector<int>>;


int main() {
	ios::sync_with_stdio(false), cin.tie(nullptr);
	int N;
	cin >> N;

	vector<double> a(N), b(N);
	for (auto &x : a) cin >> x;
	for (auto &x : b) cin >> x;

	sort(a.begin(), a.end(), greater<>());
	sort(b.begin(), b.end(), greater<>());

	double ans = 0;
	int bets_taken = 0;

	int ap = 0, bp = 0;
	double a_sum = 0, b_sum = 0;

	for (int i = 0; i < 2 * N; ++i) {
		if (ap < N && bp < N) {
			if (a_sum < b_sum) {
				a_sum += a[ap++];
			} else {
				b_sum += b[bp++];
			}
		} else if (ap < N) {
			a_sum += a[ap++];
		} else if (bp < N) {
			b_sum += b[bp++];
		} else {
			assert(0);
		}

		++bets_taken;
		ans = max(ans, min(a_sum, b_sum) - bets_taken);
	}
	
	cout << ans << endl;
}

# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -