Skip to content

Commit c42fb34

Browse files
committed
LazySegTree: fix bug
1 parent 2719cb8 commit c42fb34

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎LazySegTree/LazySegTree.java‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,11 @@ public S allProd() {
130130
}
131131

132132
public void apply(int p, F f) {
133-
Dat[p] = Mapping.apply(f, get(p));
134-
updateFrom(p + N);
133+
exclusiveRangeCheck(p);
134+
p += N;
135+
pushTo(p);
136+
Dat[p] = Mapping.apply(f, Dat[p]);
137+
updateFrom(p);
135138
}
136139

137140
public void apply(int l, int r, F f) {

0 commit comments

Comments
 (0)