# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
954106 | Beerus13 | Index (COCI21_index) | C++14 | 696 ms | 48516 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;
#define ll long long
const int N = 2e5 + 5;
const int K = 20;
const int inf = 1e9;
struct node {
int x, l, r;
node(int x = 0) {}
node(int x, int l, int r) : x(x), l(l), r(r) {}
};
int n, q, a[N], nNode, nver, ver[N];
node st[N * K];
void refine(int cur) {
st[cur].x = st[st[cur].l].x + st[st[cur].r].x;
}
int update(int pos, int val, int old, int l = 1, int r = N - 1) {
int cur = ++nNode;
if(l == r) {
st[cur] = node(st[old].x + val, 0, 0);
return cur;
}
int m = l + r >> 1;
if(pos <= m) {
st[cur].l = update(pos, val, st[old].l, l, m);
st[cur].r = st[old].r;
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... |