# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
963738 | Soumya1 | Treatment Project (JOI20_treatment) | C++17 | 326 ms | 34924 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;
using ll = long long;
const ll inf = 1e18;
const int l2 = 2e9 + 10;
struct SegmentTree {
int n;
vector<pair<int, int>> t;
vector<multiset<pair<int, int>>> mst;
SegmentTree(int _n) {
n = _n;
t.assign(4 * n, {l2, l2});
mst.resize(n + 1);
}
void update(int x, int lx, int rx, int i, pair<int, int> v, bool erase) {
if (lx == rx) {
if (erase) mst[lx].erase(mst[lx].find(v));
else mst[lx].insert(v);
if (mst[lx].empty()) t[x] = {l2, l2};
else t[x] = *mst[lx].begin();
return;
}
int mx = (lx + rx) >> 1;
if (i <= mx) update(x << 1, lx, mx, i, v, erase);
else update(x << 1 | 1, mx + 1, rx, i, v, erase);
t[x] = min(t[x << 1], t[x << 1 | 1]);
}
pair<int, int> query(int x, int lx, int rx, int l, int r) {
if (l > rx || lx > r || l > r) return {l2, l2};
if (l <= lx && r >= rx) return t[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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |