| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 115062 | IOrtroiii | Sure Bet (CEOI17_sure) | C++14 | 94 ms | 3812 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
priority_queue<double> qa;
priority_queue<double> qb;
for (int i = 1; i <= n; ++i) {
double a, b;
scanf("%lf %lf", &a, &b);
qa.emplace(a);
qb.emplace(b);
}
double sa = 0.0;
double sb = 0.0;
double ans = 0.0;
for (int i = 1; i <= 2 * n; ++i) {
if (sa < sb) {
if (qa.empty()) break;
sa += qa.top();
qa.pop();
} else {
if (qb.empty()) break;
sb += qb.top();
qb.pop();
}
ans = max(ans, min(sa, sb) - 1.0 * i);
}
cout << fixed << setprecision(4) << ans << endl;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
