Submission #882010

#TimeUsernameProblemLanguageResultExecution timeMemory
882010AlanSure Bet (CEOI17_sure)C++17
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int main () { int n; cin >> n; vector<ll> a (n), b (n); for (int i = 0; i < n; i++) { double x, y; cin >> x >> y; a[i] = round(x*10000); b[i] = round(y*10000); } sort(a.rbegin(), a.rend()); sort(b.rbegin(), b.rend()); ll ans = 0; ll cura = 0, curb = 0; for (int i = 0, j = 0; i < n; i++) { cura += a[i] - 10000; curb -= 10000; while (j < n && cura-10000 > curb+b[j]-10000) { cura -= 10000; curb += b[j] - 10000; j++; } ans = max(ans, curb); if (j < n) ans = max(ans, min(cura-10000, curb+b[j]-10000)); } cout << ans/10000 << '.' << ans%10000 << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...