# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
740610 | rainboy | Exercise Deadlines (CCO20_day1problem2) | C11 | 58 ms | 4228 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>
#define N 200000
#define N_ (1 << 18) /* N_ = pow2(ceil(log2(N + 1))) */
int st[N_ * 2], n_;
void build(int n) {
int i;
n_ = 1;
while (n_ <= n)
n_ <<= 1;
for (i = 0; i < n; i++)
st[n_ + i] = 1;
for (i = n_ - 1; i > 0; i--)
st[i] = st[i << 1 | 0] + st[i << 1 | 1];
}
void update(int i) {
for (i += n_; i > 0; i >>= 1)
st[i]--;
}
int query(int l) {
int r = n_ - 1, x = 0;
for (l += n_, r += n_; l <= r; l >>= 1, r >>= 1)
if ((l & 1) == 1)
x += st[l++];
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |