Submission #678572

#TimeUsernameProblemLanguageResultExecution timeMemory
678572flappybirdSure Bet (CEOI17_sure)C++17
0 / 100
1 ms212 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...