# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
996238 | dubabuba | Index (COCI21_index) | C++14 | 664 ms | 137080 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;
struct tree {
int sum;
tree *lc, *rc;
tree() : sum(0), lc(nullptr), rc(nullptr) {};
tree(int x) : sum(x), lc(nullptr), rc(nullptr) {};
tree(tree *L, tree *R) {
sum = 0;
lc = L, rc = R;
if(lc) sum += lc->sum;
if(rc) sum += rc->sum;
}
};
const int mxn = 2e5 + 10;
int sum(tree *sus) { return sus->sum; }
int a[mxn], n, q;
tree *root[mxn];
tree *build(int tl, int tr) {
if(tl == tr) return new tree(0);
int tm = (tl + tr) / 2;
return new tree(build(tl, tm), build(tm + 1, tr));
}
tree *upt(tree *sus, int tl, int tr, int pos, int add) {
if(tl == tr) return new tree(sum(sus) + add);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |