Submission #35492

#TimeUsernameProblemLanguageResultExecution timeMemory
35492imaxblueSure Bet (CEOI17_sure)C++14
100 / 100
206 ms4664 KiB
#include <iostream> #include<queue> using namespace std; int n; double x, y, ans, c; priority_queue<double> pq, pq2; int main() { cin >> n; while(n--){ cin >> x >> y; pq.push(x); pq2.push(y); //cout << x << ' ' << y << endl; } x=y=0; while(1){ if (x<y){ if (pq.empty()) break; x+=pq.top(); pq.pop(); } else { if (pq2.empty()) break; y+=pq2.top(); pq2.pop(); } c++; //cout << x << ' ' << y << ' ' << c << endl; ans=max(min(x, y)-c, ans); } printf("%.4lf", ans); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...