# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
311153 | nikatamliani | Interval Collection (CCO20_day2problem2) | C++14 | 4764 ms | 245252 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 int N = 1e6 + 5, oo = 1e8, LEFT = 0, RIGHT = 1;
multiset < int > ms[2][N], L, R;
struct node{
int maxL, minR, best;
node() {
maxL = -oo;
minR = oo;
best = 2 * oo;
}
}tree[N * 4];
void merge(node &x, node &L, node &R) {
x.maxL = max(L.maxL, R.maxL);
x.minR = min(L.minR, R.minR);
x.best = min({L.best, R.best, R.minR - L.maxL});
}
void update(int l, int r, int x, int val, int p, int TYPE) {
if(l > x || r < x) return;
if(l == r) {
if(TYPE == LEFT) {
tree[p].maxL = val;
} else {
tree[p].minR = val;
}
tree[p].best = tree[p].minR - tree[p].maxL;
} else {
int m = l + r >> 1;
update(l, m, x, val, p << 1, TYPE);
update(m + 1, r, x, val, p << 1 | 1, TYPE);
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |