Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions LazySegTree/LazySegTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*
* @verified https://atcoder.jp/contests/practice2/tasks/practice2_k
*/

class LazySegTree<S, F> {
final int MAX;

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

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

public int minLeft(int r, java.util.function.Predicate<S> g) {
inclusiveRangeCheck(r);
if (!f.test(E)) {
if (!g.test(E)) {
throw new IllegalArgumentException("Identity element must satisfy the condition.");
}
if (r == 0) return 0;
Expand Down
4 changes: 4 additions & 0 deletions LazySegTree/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,7 @@ fが単調だとすれば、`f(op(a[l], a[l + 1], ..., a[r - 1])) = true` とな
計算量

$O(\log n)$

## 使用例

[AtCoder Library Practice Contest K - Range Affine Range Sum](https://atcoder.jp/contests/practice2/submissions/16646083)
4 changes: 4 additions & 0 deletions MaxFlow/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,7 @@ public void changeEdge(int i, long newCap, long newFlow)
計算量

$O(1)

## 使用例

[AtCoder Library Practice Contest D - Maxflow](https://atcoder.jp/contests/practice2/submissions/16646346)
4 changes: 4 additions & 0 deletions SegTree.java/Readme.md → SegTree/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,7 @@ fが単調だとすれば、`f(op(a[l], a[l + 1], ..., a[r - 1])) = true` とな
計算量

$O(\log n)$

## 使用例

[AtCoder Library Practice Contest J - Segment Tree](https://atcoder.jp/contests/practice2/submissions/16646450)
File renamed without changes.