Submission #881842

#TimeUsernameProblemLanguageResultExecution timeMemory
881842SharkySure Bet (CEOI17_sure)C++17
100 / 100
106 ms3664 KiB
#include <bits/stdc++.h> using namespace std; using db = double; int32_t main() { int n; cin >> n; vector<db> a(n), b(n); db ans = 0, sa = 0, sb = 0; for (int i = 0; i < n; i++) cin >> a[i] >> b[i]; sort(a.rbegin(), a.rend()); sort(b.rbegin(), b.rend()); int pa = 0, pb = 0; for (int i = 1; i <= 2 * n; i++) { if (sa <= sb && pa < n) sa += a[pa++]; else if (sb <= sa && pb < n) sb += b[pb++]; ans = max(ans, min(sa, sb) - i); } cout << fixed << setprecision(4) << ans << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...