# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
252100 | thecodingwizard | Cake (CEOI14_cake) | C++11 | 686 ms | 13308 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;
struct SegTree {
int n;
vector<int> st;
void init(int _n) {
n = _n;
st.assign(4*n, 0);
}
void upd(int p, int i, int j, int k, int v) {
if (k < i || k > j) return;
if (i == j) {
st[p] = v;
} else {
upd(p << 1, i, (i+j)/2, k, v);
upd((p << 1) + 1, (i+j)/2+1, j, k, v);
st[p] = max(st[p*2],st[p*2+1]);
}
}
void upd(int p, int v) {
upd(1, 0, n-1, p, v);
}
int qry(int p, int i, int j, int L, int R) {
if (R < i || L > j) return 0;
if (L <= i && j <= R) return st[p];
return max(qry(p << 1, i, (i+j)/2, L, R), qry((2*p+1), (i+j)/2+1, j, L, R));
}
int qry(int i, int j) {
# | 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... |