Skip to content

Commit

Permalink
fix segtree_lazy value type
Browse files Browse the repository at this point in the history
  • Loading branch information
idat50me committed Jun 8, 2024
1 parent 02f12f0 commit 53c9710
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tree/segtree_lazy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ template<typename T, typename M> struct segtree_lazy {
node.resize(2 * siz - 1, ex);
lazy.resize(2 * siz - 1, em);
}
segtree_lazy(vector<T> &v, const F op, const FU f_upd, const FM f_lz, const T ex, const T em) :
segtree_lazy(vector<T> &v, const F op, const FU f_upd, const FM f_lz, const T ex, const M em) :
N(v.size()), op(op), f_upd(f_upd), f_lz(f_lz), ex(ex), em(em) {
while(siz < N) siz <<= 1;
node.resize(2 * siz - 1, ex);
Expand All @@ -37,11 +37,11 @@ template<typename T, typename M> struct segtree_lazy {
for(int i = siz - 2; i >= 0; i--) node[i] = op(node[2 * i + 1], node[2 * i + 2]);
}

void update(int idx, T val) {
void update(int idx, M val) {
assert(0 <= idx && idx < N);
upd__(idx, idx + 1, 0, val, 0, siz);
}
void update(int L, int R, T val) {
void update(int L, int R, M val) {
if(L < 0) L = 0;
if(R > N) R = N;
assert(L < R);
Expand Down

0 comments on commit 53c9710

Please sign in to comment.