# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
41117 | 14kg | 트리 (KOI16_tree) | C++11 | 409 ms | 65536 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 <stdio.h>
#include <vector>
#define NN 262144
#define INF 999999999
using namespace std;
struct Node {
int s, e, up;
} node[200001];
vector<int> r[200001];
int n, nn, q, tree_cnt, tree[NN * 2];
int max2(int x, int y) { return x > y ? x : y; }
void make_tree(int x, int up) {
node[x].up = up, node[x].s = ++tree_cnt;
for (auto i : r[x])
if (i != up) make_tree(i, x);
node[x].e = tree_cnt;
}
int get_top(int x) {
if (x == 1) return tree[1];
return max2(tree[x], get_top(x / 2));
}
void tree_push(int lev, int l, int r, int x, int y, int num) {
int mid = (l + r) / 2;
if (x <= l && r <= y) { tree[lev] = max2(tree[lev], num); return; }
if (r < x || y < l) return;
tree_push(lev * 2, l, mid, x, y, num), tree_push(lev * 2 + 1, mid + 1, r, x, y, num);
}
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... |