# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
97754 | jhnah917 | 트리 (KOI16_tree) | C++14 | 609 ms | 36576 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;
typedef pair<int, int> p;
template <typename T>
class SegTree{
private:
T tree[808080];
int lim;
function<T(const T a, const T b)> f;
public:
void init(int n, function<T(const T a, const T b)> func){
f = func;
for(lim = 1; lim <= n; lim <<= 1);
}
void update(int x, T v){
x += lim;
tree[x] = v;
while(x > 1){
x >>= 1;
tree[x] = f(tree[2*x], tree[2*x+1]);
}
}
T query(int s, int e){
s += lim;
e += lim;
T ret = 1;
while(s < e){
if(s%2 == 1) ret = f(ret, tree[s++]);
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... |