# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
167449 | tincamatei | Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) | C++14 | 2186 ms | 110128 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 MAX_N = 1000000;
int aint[1+4*MAX_N];
void update(int poz, int val, int l = 1, int r = MAX_N, int nod = 1) {
if(poz < l || r < poz) return;
if(l == r)
aint[nod] = max(aint[nod], val);
else {
int mid = (l + r) / 2;
update(poz, val, l, mid, 2 * nod);
update(poz, val, mid + 1, r, 2 * nod + 1);
aint[nod] = max(aint[2 * nod], aint[2 * nod + 1]);
}
}
int query(int i, int j, int l = 1, int r = MAX_N, int nod = 1) {
if(j < l || r < i || j < i) return -1;
if(i <= l && r <= j)
return aint[nod];
else {
int mid = (l + r) / 2;
return max(query(i, j, l, mid, 2 * nod),
query(i, j, mid + 1, r, 2 * nod + 1));
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |