# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
590327 | Soumya1 | Sky Walking (IOI19_walk) | C++17 | 4089 ms | 797232 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 "walk.h"
#include <bits/stdc++.h>
#ifdef __LOCAL__
#include <debug_local.h>
#endif
using namespace std;
template<typename T, class F = function<T(const T&, const T&)>>
struct SparseTable {
vector<vector<T>> v;
F f;
SparseTable() { };
SparseTable(vector<T> a, F _f) : f(_f) {
int n = (int) a.size();
a.resize(n);
int lg = 32 - __builtin_clz(n);
v.resize(lg);
v[0] = a;
for (int j = 1; j < lg; j++) {
v[j].resize(n - (1 << j) + 1);
for (int i = 0; i <= n - (1 << j); i++) {
v[j][i] = f(v[j - 1][i], v[j - 1][i + (1 << (j - 1))]);
}
}
}
T query(int l, int r) {
int lg = 31 - __builtin_clz(r - l + 1);
return f(v[lg][l], v[lg][r - (1 << lg) + 1]);
}
};
const int mxN = 5e6 + 5;
# | 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... |