# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1043595 | sleepntsheep | LOSTIKS (INOI20_lostiks) | C11 | 29 ms | 34388 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 <stdlib.h>
#define N 1000001
#define N_ (1<<20)
int n, s, t, *eh[N], eo[N], dep[N], up[N], par[N], sz[N], hld[N], tin[N], temp,
st[N_ * 2], uu[N], vv[N], timer, aux[N];
void add(int p, int k) {
st[p += N_] += k;
for (; p /= 2; )
st[p] = st[p * 2] + st[p * 2 + 1];
}
int query(int l, int r) {
int z = 0;
l += N_;
r += N_ + 1;
for (; l < r; l /= 2, r /= 2) {
if (l & 1) z = z + st[l++];
if (r & 1) z = st[--r] + z;
}
return z;
}
int search_rightmost(int v, int l, int r, int k) {
if (l == r) return (k - st[v]) ? l - 1 : l;
if (st[v * 2 + 1] >= k) return search_rightmost(2 * v + 1, (l+r)/2 + 1, r, k);
else return search_rightmost(2 * v, l, (l+r)/2, k - st[v * 2 + 1]);
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... |