Submission #1085412

#TimeUsernameProblemLanguageResultExecution timeMemory
1085412juicySure Bet (CEOI17_sure)C++17
0 / 100
1 ms348 KiB
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "debug.h" #else #define debug(...) 42 #endif int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<double> a(n), b(n); for (int i = 0; i < n; ++i) { cin >> a[i] >> b[i]; } sort(a.rbegin(), a.rend()); sort(b.rbegin(), b.rend()); double res = 0, A = 0, B = 0; for (int i = 0, j = 0; i < n || j < n; ) { if (j == n || A < B) { A += a[i++]; } else { B += b[j++]; } res = max(res, min(A, B) - i - j); } cout << fixed << setprecision(4) << res; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...