Submission #583319

#TimeUsernameProblemLanguageResultExecution timeMemory
583319600MihneaSure Bet (CEOI17_sure)C++17
60 / 100
2079 ms7964 KiB
#include <bits/stdc++.h> using namespace std; typedef long double ld; signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ///freopen ("input.txt", "r", stdin); int n; cin >> n; vector<ld> s1(n + 1, 0), s2(n + 1, 0); { vector<ld> 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()); for (int i = 0; i < n; i++) { s1[i + 1] = s1[i] + a[i]; s2[i + 1] = s2[i] + b[i]; } } ld sol = 0; for (int t1 = 0; t1 <= n; t1++) { for (int t2 = 0; t2 <= n; t2++) { sol = max(sol, min(s1[t1], s2[t2]) - t1 - t2); } } cout << fixed << setprecision(4) << sol << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...