This documentation is automatically generated by online-judge-tools/verification-helper
#define PROBLEM "https://judge.yosupo.jp/problem/aplusb"
#include "../../../src/template/template.hpp"
#include "../../../src/data_structure/sparse_table.hpp"
int op(int a, int b) {
return min(a, b);
}
int e() {
return (int)1e9;
}
int main() {
SparseTable<int, op, e> st(vector<int>{});
assert(st.prod(0, 0) == e());
int a, b;
cin >> a >> b;
cout << a + b << '\n';
}#line 1 "verify/unit_test/data_structure/sparse_table.test.cpp"
#define PROBLEM "https://judge.yosupo.jp/problem/aplusb"
#line 2 "src/template/template.hpp"
#include <bits/stdc++.h>
#line 4 "src/template/template.hpp"
using namespace std;
using ll = long long;
using P = pair<long long, long long>;
#define rep(i, a, b) for(long long i = (a); i < (b); ++i)
#define rrep(i, a, b) for(long long i = (a); i >= (b); --i)
constexpr long long inf = 4e18;
struct SetupIO {
SetupIO() {
ios::sync_with_stdio(0);
cin.tie(0);
cout << fixed << setprecision(30);
}
} setup_io;
#line 3 "src/data_structure/sparse_table.hpp"
template <typename S, auto op, auto e>
struct SparseTable {
SparseTable(const vector<S>& v)
: n((int)v.size()) {
const int b = n == 0 ? 1 : 32 - __builtin_clz(n);
table.assign(b, vector<S>(n, e()));
table[0] = v;
for(int i = 1; i < b; ++i) {
const int w = 1 << (i - 1);
for(int j = 0; j + w * 2 <= n; ++j) {
table[i][j] = op(table[i - 1][j], table[i - 1][j + w]);
}
}
}
S prod(const int l, const int r) const {
assert(0 <= l and l <= r and r <= n);
if(l == r) return e();
const int b = 31 - __builtin_clz(r - l);
return op(table[b][l], table[b][r - (1 << b)]);
}
private:
int n;
vector<vector<S>> table;
};
#line 4 "verify/unit_test/data_structure/sparse_table.test.cpp"
int op(int a, int b) {
return min(a, b);
}
int e() {
return (int)1e9;
}
int main() {
SparseTable<int, op, e> st(vector<int>{});
assert(st.prod(0, 0) == e());
int a, b;
cin >> a >> b;
cout << a + b << '\n';
}