Skip to content

Commit 2b3fcc0

Browse files
committed
fix LazySegTree's bug & rename SegTree folder
1 parent c42fb34 commit 2b3fcc0

4 files changed

Lines changed: 7 additions & 2 deletions

File tree

‎LazySegTree/LazySegTree.java‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*
44
* @verified https://atcoder.jp/contests/practice2/tasks/practice2_k
55
*/
6+
67
class LazySegTree<S, F> {
78
final int MAX;
89

@@ -166,7 +167,7 @@ public void apply(int l, int r, F f) {
166167

167168
public int maxRight(int l, java.util.function.Predicate<S> g) {
168169
inclusiveRangeCheck(l);
169-
if (!f.test(E)) {
170+
if (!g.test(E)) {
170171
throw new IllegalArgumentException("Identity element must satisfy the condition.");
171172
}
172173
if (l == MAX) return MAX;
@@ -194,7 +195,7 @@ public int maxRight(int l, java.util.function.Predicate<S> g) {
194195

195196
public int minLeft(int r, java.util.function.Predicate<S> g) {
196197
inclusiveRangeCheck(r);
197-
if (!f.test(E)) {
198+
if (!g.test(E)) {
198199
throw new IllegalArgumentException("Identity element must satisfy the condition.");
199200
}
200201
if (r == 0) return 0;

‎LazySegTree/Readme.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,7 @@ fが単調だとすれば、`f(op(a[l], a[l + 1], ..., a[r - 1])) = true` とな
158158
計算量
159159

160160
$O(\log n)$
161+
162+
## 使用例
163+
164+
[AtCoder Library Practice Contest K-Range Affine Range Sum](https://atcoder.jp/contests/practice2/submissions/16646083)
File renamed without changes.

0 commit comments

Comments
 (0)