Submission #907241

#TimeUsernameProblemLanguageResultExecution timeMemory
907241heeheeheehaawSure Bet (CEOI17_sure)C++17
100 / 100
144 ms5300 KiB
#include <bits/stdc++.h> using namespace std; typedef long double ld; priority_queue<ld> pq1, pq2; int main() { int n; cin>>n; for(int i = 1; i <= n; i++) { ld a, b; cin>>a>>b; pq1.push(a); pq2.push(b); } ld r1 = 0.0, r2 = 0.0, rez = 0.0; n *= 2; while(n--) { r1 -= (ld)1; r2 -= (ld)1; if(r1 < r2 || pq2.empty()) { if(!pq1.empty()) { r1 += (ld)pq1.top(); pq1.pop(); } } else { if(!pq2.empty()) { r2 += (ld)pq2.top(); pq2.pop(); } } rez = max(rez, min(r1, r2)); } printf("%.4lf",(double)rez); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...