Submission #678572

# Submission time Handle Problem Language Result Execution time Memory
678572 2023-01-06T07:43:15 Z flappybird Sure Bet (CEOI17_sure) C++17
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>
#include <cassert>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
#define MAX 101010
#define MAXS 20
#define INF 1000000000000000001
#define bb ' '
#define ln '\n'
#define Ln '\n'
ll A[MAX];
ll B[MAX];
signed main() {
	ios::sync_with_stdio(false), cin.tie(0);
	int N;
	cin >> N;
	int i;
	double a, b;
	for (i = 1; i <= N; i++) {
		cin >> a >> b;
		A[i] = a * 10000;
		B[i] = b * 10000;
	}
	sort(A + 1, A + N + 1);
	sort(B + 1, B + N + 1);
	ll sa, sb;
	int pa, pb;
	pa = pb = N;
	ll ans = 0;
	sa = sb = 0;
	for (i = 1; i <= 2 * N; i++) {
		if ((sa < sb && pa) || !pb) {
			sa += A[pa];
			pa--;
		}
		else {
			sb += B[pb];
			pb--;
		}
		ans = max(ans, min(sa, sb) - 1ll * i * 10000);
	}
	cout << fixed;
	cout.precision(4);
	cout << (double)ans / 10000. << ln;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Incorrect 1 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Incorrect 1 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Incorrect 1 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -