# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
37134 | cheater2k | Cake (CEOI14_cake) | C++14 | 566 ms | 14112 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 N = 250005;
int n, q, start, d[N];
vector<int> topten;
struct SegmentTree {
int T[N << 2]; // maxpos
SegmentTree() {
memset(T, 0, sizeof T);
}
#define mid ((l + r) >> 1)
void build(int v, int l, int r) {
if (l == r) { T[v] = l; return; }
build(v << 1, l, mid); build(v << 1 | 1, mid + 1, r);
if (d[T[v << 1]] > d[T[v << 1 | 1]]) T[v] = T[v << 1];
else T[v] = T[v << 1 | 1];
}
void upd(int v, int l, int r, int pos) {
if (l > r || l > pos || r < pos) return;
if (l == r) { T[v] = pos; return; }
upd(v << 1, l, mid, pos); upd(v << 1 | 1, mid + 1, r, pos);
if (d[T[v << 1]] > d[T[v << 1 | 1]]) T[v] = T[v << 1];
else T[v] = T[v << 1 | 1];
}
int get(int v, int l, int r, int L, int R) {
if (l > r || R < l || L > r) return 0;
if (L <= l && r <= R) return T[v];
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |