# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
591980 | piOOE | Fire (JOI20_ho_t5) | C++17 | 1087 ms | 16076 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;
using ll = long long;
template <typename T>
struct SparseTable { //max
int n;
vector<vector<T>> st;
SparseTable(const vector<T>& a) {
n = static_cast<int>(a.size());
int max_log = 32 - __builtin_clz(n);
st.resize(max_log);
st[0] = a;
for (int j = 1; j < max_log; ++j) {
st[j].resize(n - (1 << j) + 1);
for (int i = 0; i <= n - (1 << j); ++i) {
st[j][i] = max(st[j - 1][i], st[j - 1][i + (1 << (j - 1))]);
}
}
}
SparseTable() = default;
T get(int L, int R) const {
assert(0 <= L && L < R && R <= n);
int lg = __lg(R - L);
return max(st[lg][L], st[lg][R - (1 << lg)]);
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |