Submission #1113303

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
11133032024-11-16 10:22:24flashmtEvent Hopping (BOI22_events)C++17
100 / 100
236 ms52736 KiB
#include <bits/stdc++.h>
using namespace std;
template<typename T>
struct SparseTable
{
int n;
vector<vector<T>> mat;
SparseTable(const vector<T>& a)
{
n = int(a.size());
int maxLog = 32 - __builtin_clz(n);
mat.resize(maxLog);
mat[0] = a;
for (int j = 1; j < maxLog; j++)
{
mat[j].resize(n - (1 << j) + 1);
for (int i = 0; i <= n - (1 << j); i++)
mat[j][i] = min(mat[j - 1][i], mat[j - 1][i + (1 << (j - 1))]);
}
}
T get(int from, int to)
{
assert(0 <= from && from <= to && to <= n - 1);
int lg = 31 - __builtin_clz(to - from + 1);
return min(mat[lg][from], mat[lg][to - (1 << lg) + 1]);
}
};
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...