This documentation is automatically generated by online-judge-tools/verification-helper
#include "lib/ds/segtree.hpp"
#pragma once
#include "lib/internal.hpp"
#include "lib/misc/bitop.hpp"
#include "lib/monoid/monoid_trait.hpp"
/**
* @brief Segment Tree
*
* @tparam M Monoid
*/
template <typename M> struct SegmentTree
{
using S = typename M::S;
u32 m;
vec<S> t;
SegmentTree() {}
SegmentTree(u32 n): m(btc(n)), t(m * 2, M::un()) { ; }
template <typename I>
SegmentTree(u32 n, const I &f): m(btc(n)), t(m * 2, M::un())
{
for (u32 i = 0; i < n; i++) t[i + m] = f(i);
for (u32 i = m - 1; ~i; i--) t[i] = M::op(t[i * 2], t[i * 2 + 1]);
}
void set(u32 p, const S &v)
{
t[p += m] = v;
for (p /= 2; p; p /= 2) t[p] = M::op(t[p * 2], t[p * 2 + 1]);
}
S get(u32 p) { return t[p + m]; }
S prod(u32 l, u32 r)
{
S lans = M::un(), rans = M::un();
for (l += m, r += m; l < r; l /= 2, r /= 2) {
if (l & 1) lans = M::op(lans, t[l++]);
if (r & 1) rans = M::op(t[--r], rans);
}
return M::op(lans, rans);
}
S all_prod() { return t[1]; }
};
Traceback (most recent call last):
File "/home/runner/.local/lib/python3.10/site-packages/onlinejudge_verify/documentation/build.py", line 71, in _render_source_code_stat
bundled_code = language.bundle(stat.path, basedir=basedir, options={'include_paths': [basedir]}).decode()
File "/home/runner/.local/lib/python3.10/site-packages/onlinejudge_verify/languages/cplusplus.py", line 187, in bundle
bundler.update(path)
File "/home/runner/.local/lib/python3.10/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 401, in update
self.update(self._resolve(pathlib.Path(included), included_from=path))
File "/home/runner/.local/lib/python3.10/site-packages/onlinejudge_verify/languages/cplusplus_bundle.py", line 312, in update
raise BundleErrorAt(path, i + 1, "#pragma once found in a non-first line")
onlinejudge_verify.languages.cplusplus_bundle.BundleErrorAt: lib/internal.hpp: line 4: #pragma once found in a non-first line