# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
402572 | Talha_Taki | Index (COCI21_index) | C++17 | 1244 ms | 137276 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 MAXN = 2e5;
struct Vertex {
Vertex *l, *r;
int cnt;
Vertex(int val) : l(nullptr), r(nullptr), cnt(val) {}
Vertex(Vertex* l, Vertex* r) : l(l), r(r), cnt(0) {
if (l) cnt += l->cnt;
if (r) cnt += r->cnt;
}
};
struct persistenSegmentTree {
Vertex* build(int l, int r) {
if (l == r) return new Vertex(0);
int mid = (l+r)>>1;
return new Vertex(build(l, mid), build(mid+1, r));
}
Vertex* update(Vertex* v, int l, int r, const int val) {
if (l == r) return new Vertex(v->cnt+1);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |