# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
312503 | nathanlee726 | Cake 3 (JOI19_cake3) | C++14 | 3898 ms | 11256 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;
const long long inf = 1ll << 60;
class solver {
public:
multiset<int> already, candidate;
long long ans;
int m;
solver(int m): m(m) {
ans = 0;
}
void insert(int x) {
if ((int) already.size() == m) {
if (x > *already.begin()) {
ans += x - *already.begin();
candidate.insert(*already.begin());
already.erase(already.begin());
already.insert(x);
} else {
candidate.insert(x);
}
} else {
already.insert(x);
ans += x;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |