# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
966885 | Trisanu_Das | Worst Reporter 4 (JOI21_worst_reporter4) | C++17 | 289 ms | 92400 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() {
ios::sync_with_stdio(false); cin.tie(nullptr);
int n; cin >> n;
vector<int> a(n), h(n), c(n);
for (int u = 0; u < n; u++) {
cin >> a[u] >> h[u] >> c[u];
a[u]--;
}
vector<map<int, long long>> f(n);
auto add = [](map<int, long long> &x, map<int, long long> &y) {
if (y.size() > x.size()) swap(x, y);
for (auto [h, c] : y) x[h] += c;
};
auto fix = [](map<int, long long> &x, int h, long long c) {
x[h] += c;
auto it = x.lower_bound(h);
while (it != x.begin()) {
it = prev(it);
if (it->second <= c) {
c -= it->second;
it = x.erase(it);
} else {
it->second -= c;
break;
}
}
};
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |