From 4c88f6150dfd7f9f69a45d4e03618252340b8d0f Mon Sep 17 00:00:00 2001 From: Luke Videckis Date: Sat, 7 Feb 2026 02:31:09 -0700 Subject: [PATCH 01/27] Enhance walk function with optimized logic Refactor walk function to improve performance and clarity. --- .../data_structures_[l,r]/seg_tree_uncommon/walk.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp b/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp index 03e61ddf..2a1a2834 100644 --- a/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp +++ b/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp @@ -1,4 +1,10 @@ +int go(int l, int r) { +//return __lg(min(l & -l, r - l + 1)); +//return __lg(min((l + n) & -(l + n), r - l + 1)); + return min(__builtin_ctz(l + n), __lg(r - l + 1)); +} int walk(int l, int r, const auto& f) { + /* for (l += n, r += n; l <= r;) if (int u = nxt(l, r); f(s[u])) { while (u < n) @@ -6,5 +12,11 @@ int walk(int l, int r, const auto& f) { else (u *= 2)++; return u - n; } + */ + while (l <= r) { + int u = l + n, x = __lg(min(u & -u, r - l + 1)); + if (f(s[u >> x])) r = l + (1 << x) - 1; + else l += 1 << x; + } return -1; } From 3beb2d193a58f8d1dc1d6fde6e03cf5600d88b7a Mon Sep 17 00:00:00 2001 From: Luke Videckis Date: Sat, 7 Feb 2026 02:34:21 -0700 Subject: [PATCH 02/27] Fix boundary condition in segment tree walk --- library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp b/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp index 2a1a2834..17ef06de 100644 --- a/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp +++ b/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp @@ -15,7 +15,7 @@ int walk(int l, int r, const auto& f) { */ while (l <= r) { int u = l + n, x = __lg(min(u & -u, r - l + 1)); - if (f(s[u >> x])) r = l + (1 << x) - 1; + if (f(s[u >> x])) r = l + (1 << x) - 2; else l += 1 << x; } return -1; From 0f954e4ddcbad0e385e13505f6289a571369c65a Mon Sep 17 00:00:00 2001 From: GitHub Date: Sat, 7 Feb 2026 09:37:10 +0000 Subject: [PATCH 03/27] [auto-verifier] verify commit 3beb2d193a58f8d1dc1d6fde6e03cf5600d88b7a --- .verify-helper/timestamps.remote.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.verify-helper/timestamps.remote.json b/.verify-helper/timestamps.remote.json index 88ae378e..cf344057 100644 --- a/.verify-helper/timestamps.remote.json +++ b/.verify-helper/timestamps.remote.json @@ -44,9 +44,8 @@ "tests/library_checker_aizu_tests/data_structures/rmq_sparse_table.test.cpp": "2026-01-18 11:15:41 +0000", "tests/library_checker_aizu_tests/data_structures/rmq_sparse_table_inc.test.cpp": "2026-01-18 11:15:41 +0000", "tests/library_checker_aizu_tests/data_structures/simple_tree.test.cpp": "2026-01-28 21:53:13 -0700", -"tests/library_checker_aizu_tests/data_structures/simple_tree_inc.test.cpp": "2026-02-05 16:06:35 -0700", -"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_line.test.cpp": "2026-02-05 16:06:35 -0700", -"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp": "2026-02-05 16:06:35 -0700", +"tests/library_checker_aizu_tests/data_structures/simple_tree_inc.test.cpp": "2026-02-07 02:34:21 -0700", +"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_line.test.cpp": "2026-02-07 02:34:21 -0700", "tests/library_checker_aizu_tests/data_structures/simple_tree_line.test.cpp": "2026-01-28 21:53:13 -0700", "tests/library_checker_aizu_tests/flow/dinic_aizu.test.cpp": "2024-11-17 14:04:03 -0600", "tests/library_checker_aizu_tests/flow/hungarian.test.cpp": "2024-11-17 14:04:03 -0600", From 4db7b00c773c92e6ae1b99e598b81274c9f2acf7 Mon Sep 17 00:00:00 2001 From: Luke Videckis Date: Sat, 7 Feb 2026 02:48:01 -0700 Subject: [PATCH 04/27] Fix boundary condition in segment tree walk function --- library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp b/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp index 17ef06de..64b881a0 100644 --- a/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp +++ b/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp @@ -14,8 +14,8 @@ int walk(int l, int r, const auto& f) { } */ while (l <= r) { - int u = l + n, x = __lg(min(u & -u, r - l + 1)); - if (f(s[u >> x])) r = l + (1 << x) - 2; + int u = l + n, x = __lg(min(u & -u, int(bit_ceil(r - l + 1u)-1)); + if (f(s[u >> x])) r = l + (1 << x) - 1; else l += 1 << x; } return -1; From 267032c5a5b9ab40d785edea8bb77bf253ed9845 Mon Sep 17 00:00:00 2001 From: Luke Videckis Date: Sat, 7 Feb 2026 02:48:32 -0700 Subject: [PATCH 05/27] Fix bug in segment tree walk function --- library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp b/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp index 64b881a0..c252d702 100644 --- a/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp +++ b/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp @@ -14,7 +14,7 @@ int walk(int l, int r, const auto& f) { } */ while (l <= r) { - int u = l + n, x = __lg(min(u & -u, int(bit_ceil(r - l + 1u)-1)); + int u = l + n, x = __lg(min(u & -u, r - l)); if (f(s[u >> x])) r = l + (1 << x) - 1; else l += 1 << x; } From ffa57c7c7afb8149ccf6e381087ccddf4a789824 Mon Sep 17 00:00:00 2001 From: GitHub Date: Sat, 7 Feb 2026 09:51:26 +0000 Subject: [PATCH 06/27] [auto-verifier] verify commit 267032c5a5b9ab40d785edea8bb77bf253ed9845 --- .verify-helper/timestamps.remote.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.verify-helper/timestamps.remote.json b/.verify-helper/timestamps.remote.json index cf344057..b9e69cca 100644 --- a/.verify-helper/timestamps.remote.json +++ b/.verify-helper/timestamps.remote.json @@ -44,8 +44,8 @@ "tests/library_checker_aizu_tests/data_structures/rmq_sparse_table.test.cpp": "2026-01-18 11:15:41 +0000", "tests/library_checker_aizu_tests/data_structures/rmq_sparse_table_inc.test.cpp": "2026-01-18 11:15:41 +0000", "tests/library_checker_aizu_tests/data_structures/simple_tree.test.cpp": "2026-01-28 21:53:13 -0700", -"tests/library_checker_aizu_tests/data_structures/simple_tree_inc.test.cpp": "2026-02-07 02:34:21 -0700", -"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_line.test.cpp": "2026-02-07 02:34:21 -0700", +"tests/library_checker_aizu_tests/data_structures/simple_tree_inc.test.cpp": "2026-02-07 02:48:32 -0700", +"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_line.test.cpp": "2026-02-07 02:48:32 -0700", "tests/library_checker_aizu_tests/data_structures/simple_tree_line.test.cpp": "2026-01-28 21:53:13 -0700", "tests/library_checker_aizu_tests/flow/dinic_aizu.test.cpp": "2024-11-17 14:04:03 -0600", "tests/library_checker_aizu_tests/flow/hungarian.test.cpp": "2024-11-17 14:04:03 -0600", From cc93d6221e77510e17f3551bc23f44c5215d482e Mon Sep 17 00:00:00 2001 From: Luke Videckis Date: Sat, 7 Feb 2026 02:54:46 -0700 Subject: [PATCH 07/27] Update segment tree walk logic with good flag Refactor segment tree walk function to use a boolean flag for condition checking. --- library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp b/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp index c252d702..08c00b21 100644 --- a/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp +++ b/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp @@ -13,10 +13,12 @@ int walk(int l, int r, const auto& f) { return u - n; } */ + bool good=0; while (l <= r) { - int u = l + n, x = __lg(min(u & -u, r - l)); - if (f(s[u >> x])) r = l + (1 << x) - 1; + int u = l + n, x = __lg(min(u & -u, r - l + 1)); + if (f(s[u >> x])) good=1,r = l + (1 << x) - 1; else l += 1 << x; } - return -1; + return good ? l ; -1; + // return l; } From 5e83a0a18abf4529a2529fa4464dfc2d36928dc3 Mon Sep 17 00:00:00 2001 From: GitHub Date: Sat, 7 Feb 2026 09:56:13 +0000 Subject: [PATCH 08/27] [auto-verifier] verify commit cc93d6221e77510e17f3551bc23f44c5215d482e --- .verify-helper/timestamps.remote.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/.verify-helper/timestamps.remote.json b/.verify-helper/timestamps.remote.json index b9e69cca..93a468b8 100644 --- a/.verify-helper/timestamps.remote.json +++ b/.verify-helper/timestamps.remote.json @@ -44,8 +44,6 @@ "tests/library_checker_aizu_tests/data_structures/rmq_sparse_table.test.cpp": "2026-01-18 11:15:41 +0000", "tests/library_checker_aizu_tests/data_structures/rmq_sparse_table_inc.test.cpp": "2026-01-18 11:15:41 +0000", "tests/library_checker_aizu_tests/data_structures/simple_tree.test.cpp": "2026-01-28 21:53:13 -0700", -"tests/library_checker_aizu_tests/data_structures/simple_tree_inc.test.cpp": "2026-02-07 02:48:32 -0700", -"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_line.test.cpp": "2026-02-07 02:48:32 -0700", "tests/library_checker_aizu_tests/data_structures/simple_tree_line.test.cpp": "2026-01-28 21:53:13 -0700", "tests/library_checker_aizu_tests/flow/dinic_aizu.test.cpp": "2024-11-17 14:04:03 -0600", "tests/library_checker_aizu_tests/flow/hungarian.test.cpp": "2024-11-17 14:04:03 -0600", From 42d4c51e879480ff066f4e045481dee8695a3233 Mon Sep 17 00:00:00 2001 From: Luke Videckis Date: Sat, 7 Feb 2026 09:58:52 -0700 Subject: [PATCH 09/27] Fix loop condition in segment tree walk function --- library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp b/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp index 08c00b21..5bf10fd9 100644 --- a/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp +++ b/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp @@ -14,8 +14,8 @@ int walk(int l, int r, const auto& f) { } */ bool good=0; - while (l <= r) { - int u = l + n, x = __lg(min(u & -u, r - l + 1)); + while (l < r) { + int u = l + n, x = __lg(min(u & -u, r - l)); if (f(s[u >> x])) good=1,r = l + (1 << x) - 1; else l += 1 << x; } From 3f31866b5d8d39b8a3f19462c75a604fda7dbc20 Mon Sep 17 00:00:00 2001 From: Luke Videckis Date: Sat, 7 Feb 2026 10:02:01 -0700 Subject: [PATCH 10/27] Fix return statement syntax in walk.hpp --- library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp b/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp index 5bf10fd9..622cb086 100644 --- a/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp +++ b/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp @@ -19,6 +19,6 @@ int walk(int l, int r, const auto& f) { if (f(s[u >> x])) good=1,r = l + (1 << x) - 1; else l += 1 << x; } - return good ? l ; -1; + return good ? l : -1; // return l; } From fce30fb9c9b3d98cad80b574868444cea7adc3d2 Mon Sep 17 00:00:00 2001 From: GitHub Date: Sat, 7 Feb 2026 17:04:52 +0000 Subject: [PATCH 11/27] [auto-verifier] verify commit 3f31866b5d8d39b8a3f19462c75a604fda7dbc20 --- .verify-helper/timestamps.remote.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.verify-helper/timestamps.remote.json b/.verify-helper/timestamps.remote.json index 93a468b8..da791b07 100644 --- a/.verify-helper/timestamps.remote.json +++ b/.verify-helper/timestamps.remote.json @@ -44,6 +44,8 @@ "tests/library_checker_aizu_tests/data_structures/rmq_sparse_table.test.cpp": "2026-01-18 11:15:41 +0000", "tests/library_checker_aizu_tests/data_structures/rmq_sparse_table_inc.test.cpp": "2026-01-18 11:15:41 +0000", "tests/library_checker_aizu_tests/data_structures/simple_tree.test.cpp": "2026-01-28 21:53:13 -0700", +"tests/library_checker_aizu_tests/data_structures/simple_tree_inc.test.cpp": "2026-02-07 10:02:01 -0700", +"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_line.test.cpp": "2026-02-07 10:02:01 -0700", "tests/library_checker_aizu_tests/data_structures/simple_tree_line.test.cpp": "2026-01-28 21:53:13 -0700", "tests/library_checker_aizu_tests/flow/dinic_aizu.test.cpp": "2024-11-17 14:04:03 -0600", "tests/library_checker_aizu_tests/flow/hungarian.test.cpp": "2024-11-17 14:04:03 -0600", From b741e864771cb6c048bde39a56d78be8e9c1abc4 Mon Sep 17 00:00:00 2001 From: Luke Videckis Date: Sat, 7 Feb 2026 10:12:27 -0700 Subject: [PATCH 12/27] Fix loop condition and variable initialization in walk.hpp --- library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp b/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp index 622cb086..a1ec6bbf 100644 --- a/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp +++ b/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp @@ -13,9 +13,9 @@ int walk(int l, int r, const auto& f) { return u - n; } */ - bool good=0; - while (l < r) { - int u = l + n, x = __lg(min(u & -u, r - l)); + int good=0; + while (l <= r) { + int u = l + n, x = __lg(min(u & -u, r - l +1-good)); if (f(s[u >> x])) good=1,r = l + (1 << x) - 1; else l += 1 << x; } From e43234d931e8c0e1666b5415ff06ad55c905c8ee Mon Sep 17 00:00:00 2001 From: GitHub Date: Sat, 7 Feb 2026 17:15:08 +0000 Subject: [PATCH 13/27] [auto-verifier] verify commit b741e864771cb6c048bde39a56d78be8e9c1abc4 --- .verify-helper/timestamps.remote.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.verify-helper/timestamps.remote.json b/.verify-helper/timestamps.remote.json index da791b07..b91c59f1 100644 --- a/.verify-helper/timestamps.remote.json +++ b/.verify-helper/timestamps.remote.json @@ -44,8 +44,8 @@ "tests/library_checker_aizu_tests/data_structures/rmq_sparse_table.test.cpp": "2026-01-18 11:15:41 +0000", "tests/library_checker_aizu_tests/data_structures/rmq_sparse_table_inc.test.cpp": "2026-01-18 11:15:41 +0000", "tests/library_checker_aizu_tests/data_structures/simple_tree.test.cpp": "2026-01-28 21:53:13 -0700", -"tests/library_checker_aizu_tests/data_structures/simple_tree_inc.test.cpp": "2026-02-07 10:02:01 -0700", -"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_line.test.cpp": "2026-02-07 10:02:01 -0700", +"tests/library_checker_aizu_tests/data_structures/simple_tree_inc.test.cpp": "2026-02-07 10:12:27 -0700", +"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_line.test.cpp": "2026-02-07 10:12:27 -0700", "tests/library_checker_aizu_tests/data_structures/simple_tree_line.test.cpp": "2026-01-28 21:53:13 -0700", "tests/library_checker_aizu_tests/flow/dinic_aizu.test.cpp": "2024-11-17 14:04:03 -0600", "tests/library_checker_aizu_tests/flow/hungarian.test.cpp": "2024-11-17 14:04:03 -0600", From a837375fb537d6061d7a63f0b7e99ce52360d9bc Mon Sep 17 00:00:00 2001 From: Luke Videckis Date: Sat, 7 Feb 2026 10:25:54 -0700 Subject: [PATCH 14/27] Update walk.hpp --- library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp b/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp index a1ec6bbf..960548fc 100644 --- a/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp +++ b/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp @@ -14,7 +14,7 @@ int walk(int l, int r, const auto& f) { } */ int good=0; - while (l <= r) { + while (l <= r-good) { int u = l + n, x = __lg(min(u & -u, r - l +1-good)); if (f(s[u >> x])) good=1,r = l + (1 << x) - 1; else l += 1 << x; From 42e22a562910bb1cbae503040a731893c748682e Mon Sep 17 00:00:00 2001 From: GitHub Date: Sat, 7 Feb 2026 17:28:01 +0000 Subject: [PATCH 15/27] [auto-verifier] verify commit a837375fb537d6061d7a63f0b7e99ce52360d9bc --- .verify-helper/timestamps.remote.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.verify-helper/timestamps.remote.json b/.verify-helper/timestamps.remote.json index b91c59f1..9e2f3a02 100644 --- a/.verify-helper/timestamps.remote.json +++ b/.verify-helper/timestamps.remote.json @@ -44,8 +44,9 @@ "tests/library_checker_aizu_tests/data_structures/rmq_sparse_table.test.cpp": "2026-01-18 11:15:41 +0000", "tests/library_checker_aizu_tests/data_structures/rmq_sparse_table_inc.test.cpp": "2026-01-18 11:15:41 +0000", "tests/library_checker_aizu_tests/data_structures/simple_tree.test.cpp": "2026-01-28 21:53:13 -0700", -"tests/library_checker_aizu_tests/data_structures/simple_tree_inc.test.cpp": "2026-02-07 10:12:27 -0700", -"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_line.test.cpp": "2026-02-07 10:12:27 -0700", +"tests/library_checker_aizu_tests/data_structures/simple_tree_inc.test.cpp": "2026-02-07 10:25:54 -0700", +"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_line.test.cpp": "2026-02-07 10:25:54 -0700", +"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp": "2026-02-07 10:25:54 -0700", "tests/library_checker_aizu_tests/data_structures/simple_tree_line.test.cpp": "2026-01-28 21:53:13 -0700", "tests/library_checker_aizu_tests/flow/dinic_aizu.test.cpp": "2024-11-17 14:04:03 -0600", "tests/library_checker_aizu_tests/flow/hungarian.test.cpp": "2024-11-17 14:04:03 -0600", From b9c25bcda59f3465f0eb62c10a3f54bf32f91939 Mon Sep 17 00:00:00 2001 From: Luke Videckis Date: Sat, 7 Feb 2026 11:04:23 -0700 Subject: [PATCH 16/27] more golf! --- .../seg_tree_uncommon/walk.hpp | 24 ++++--------------- .../simple_tree_inc_walk.test.cpp | 6 +++-- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp b/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp index 960548fc..7c580885 100644 --- a/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp +++ b/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp @@ -1,24 +1,8 @@ -int go(int l, int r) { -//return __lg(min(l & -l, r - l + 1)); -//return __lg(min((l + n) & -(l + n), r - l + 1)); - return min(__builtin_ctz(l + n), __lg(r - l + 1)); -} int walk(int l, int r, const auto& f) { - /* - for (l += n, r += n; l <= r;) - if (int u = nxt(l, r); f(s[u])) { - while (u < n) - if (f(s[2 * u])) u *= 2; - else (u *= 2)++; - return u - n; - } - */ - int good=0; - while (l <= r-good) { - int u = l + n, x = __lg(min(u & -u, r - l +1-good)); - if (f(s[u >> x])) good=1,r = l + (1 << x) - 1; + while (l <= r) { + int u = l + n, x = __lg(min(u & -u, r - l + 1)); + if (f(s[u >> x])) r = l + (1 << x) - 2; else l += 1 << x; } - return good ? l : -1; - // return l; + return l; } diff --git a/tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp b/tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp index 1dd9fcf9..e140cddc 100644 --- a/tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp @@ -22,9 +22,11 @@ int main() { cout << st.query(k, k) << '\n'; } else if (type == 3) { // returns first element in [k,n-1] such that sum > 0 - cout << st.walk(k, n - 1, [&](int sum) { + int idx = st.walk(k, n - 1, [&](int sum) { return sum > 0; - }) << '\n'; + }); + if(idx == n) idx = -1; + cout< Date: Sat, 7 Feb 2026 18:06:43 +0000 Subject: [PATCH 17/27] [auto-verifier] verify commit b9c25bcda59f3465f0eb62c10a3f54bf32f91939 --- .verify-helper/timestamps.remote.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.verify-helper/timestamps.remote.json b/.verify-helper/timestamps.remote.json index 9e2f3a02..682c7fff 100644 --- a/.verify-helper/timestamps.remote.json +++ b/.verify-helper/timestamps.remote.json @@ -44,9 +44,9 @@ "tests/library_checker_aizu_tests/data_structures/rmq_sparse_table.test.cpp": "2026-01-18 11:15:41 +0000", "tests/library_checker_aizu_tests/data_structures/rmq_sparse_table_inc.test.cpp": "2026-01-18 11:15:41 +0000", "tests/library_checker_aizu_tests/data_structures/simple_tree.test.cpp": "2026-01-28 21:53:13 -0700", -"tests/library_checker_aizu_tests/data_structures/simple_tree_inc.test.cpp": "2026-02-07 10:25:54 -0700", -"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_line.test.cpp": "2026-02-07 10:25:54 -0700", -"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp": "2026-02-07 10:25:54 -0700", +"tests/library_checker_aizu_tests/data_structures/simple_tree_inc.test.cpp": "2026-02-07 11:04:23 -0700", +"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_line.test.cpp": "2026-02-07 11:04:23 -0700", +"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp": "2026-02-07 11:04:23 -0700", "tests/library_checker_aizu_tests/data_structures/simple_tree_line.test.cpp": "2026-01-28 21:53:13 -0700", "tests/library_checker_aizu_tests/flow/dinic_aizu.test.cpp": "2024-11-17 14:04:03 -0600", "tests/library_checker_aizu_tests/flow/hungarian.test.cpp": "2024-11-17 14:04:03 -0600", From 5743f65eb05655b313f4d4d52d816d16839ec4de Mon Sep 17 00:00:00 2001 From: Luke Videckis Date: Sat, 7 Feb 2026 17:12:53 -0700 Subject: [PATCH 18/27] Reverse conditions in walk function logic --- library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp b/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp index 7c580885..c3ef7dbb 100644 --- a/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp +++ b/library/data_structures_[l,r]/seg_tree_uncommon/walk.hpp @@ -1,8 +1,8 @@ int walk(int l, int r, const auto& f) { while (l <= r) { int u = l + n, x = __lg(min(u & -u, r - l + 1)); - if (f(s[u >> x])) r = l + (1 << x) - 2; - else l += 1 << x; + if (f(s[u >> x])) l += 1 << x; + else r = l + (1 << x) - 2; } return l; } From 1ea3e05d27a1bbf222e09bac40df287569eb2a2b Mon Sep 17 00:00:00 2001 From: Luke Videckis Date: Sat, 7 Feb 2026 17:14:17 -0700 Subject: [PATCH 19/27] Change condition in walk function for sum check --- .../data_structures/simple_tree_inc_walk.test.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp b/tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp index e140cddc..e465130a 100644 --- a/tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp @@ -23,7 +23,7 @@ int main() { } else if (type == 3) { // returns first element in [k,n-1] such that sum > 0 int idx = st.walk(k, n - 1, [&](int sum) { - return sum > 0; + return sum == 0; }); if(idx == n) idx = -1; cout< Date: Sat, 7 Feb 2026 17:15:13 -0700 Subject: [PATCH 20/27] Fix comment to clarify index search condition --- library/data_structures_[l,r]/seg_tree.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/data_structures_[l,r]/seg_tree.hpp b/library/data_structures_[l,r]/seg_tree.hpp index df0f4f57..d0dd7489 100644 --- a/library/data_structures_[l,r]/seg_tree.hpp +++ b/library/data_structures_[l,r]/seg_tree.hpp @@ -13,7 +13,7 @@ //! tree st(n, INT_MAX, ranges::min); //! int idx = st.walk(l, r, [&](int value) { //! return value <= x; -//! }); // smallest index in [l, r] s.t. f is true +//! }); // smallest index in [l, r] s.t. f is false //! } //! @endcode //! @time O(n + q log n) From ad92a0b9ae781db88045634f425f86ca95d882b0 Mon Sep 17 00:00:00 2001 From: GitHub Date: Sun, 8 Feb 2026 00:17:22 +0000 Subject: [PATCH 21/27] [auto-verifier] verify commit 6405c5e3c6e93b56663ca377efd005b04cdba868 --- .verify-helper/timestamps.remote.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.verify-helper/timestamps.remote.json b/.verify-helper/timestamps.remote.json index 682c7fff..6814771d 100644 --- a/.verify-helper/timestamps.remote.json +++ b/.verify-helper/timestamps.remote.json @@ -44,9 +44,9 @@ "tests/library_checker_aizu_tests/data_structures/rmq_sparse_table.test.cpp": "2026-01-18 11:15:41 +0000", "tests/library_checker_aizu_tests/data_structures/rmq_sparse_table_inc.test.cpp": "2026-01-18 11:15:41 +0000", "tests/library_checker_aizu_tests/data_structures/simple_tree.test.cpp": "2026-01-28 21:53:13 -0700", -"tests/library_checker_aizu_tests/data_structures/simple_tree_inc.test.cpp": "2026-02-07 11:04:23 -0700", -"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_line.test.cpp": "2026-02-07 11:04:23 -0700", -"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp": "2026-02-07 11:04:23 -0700", +"tests/library_checker_aizu_tests/data_structures/simple_tree_inc.test.cpp": "2026-02-07 17:15:13 -0700", +"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_line.test.cpp": "2026-02-07 17:15:13 -0700", +"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp": "2026-02-07 17:15:13 -0700", "tests/library_checker_aizu_tests/data_structures/simple_tree_line.test.cpp": "2026-01-28 21:53:13 -0700", "tests/library_checker_aizu_tests/flow/dinic_aizu.test.cpp": "2024-11-17 14:04:03 -0600", "tests/library_checker_aizu_tests/flow/hungarian.test.cpp": "2024-11-17 14:04:03 -0600", From 434c09a29b291761e0b7b71ffceee2c4aead9de9 Mon Sep 17 00:00:00 2001 From: Luke Videckis Date: Sat, 7 Feb 2026 17:17:34 -0700 Subject: [PATCH 22/27] format --- .../data_structures/simple_tree_inc_walk.test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp b/tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp index e465130a..1ca26a19 100644 --- a/tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp @@ -26,7 +26,7 @@ int main() { return sum == 0; }); if(idx == n) idx = -1; - cout< Date: Sun, 8 Feb 2026 00:19:09 +0000 Subject: [PATCH 23/27] [auto-verifier] verify commit 434c09a29b291761e0b7b71ffceee2c4aead9de9 --- .verify-helper/timestamps.remote.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.verify-helper/timestamps.remote.json b/.verify-helper/timestamps.remote.json index 6814771d..a073ab22 100644 --- a/.verify-helper/timestamps.remote.json +++ b/.verify-helper/timestamps.remote.json @@ -46,7 +46,7 @@ "tests/library_checker_aizu_tests/data_structures/simple_tree.test.cpp": "2026-01-28 21:53:13 -0700", "tests/library_checker_aizu_tests/data_structures/simple_tree_inc.test.cpp": "2026-02-07 17:15:13 -0700", "tests/library_checker_aizu_tests/data_structures/simple_tree_inc_line.test.cpp": "2026-02-07 17:15:13 -0700", -"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp": "2026-02-07 17:15:13 -0700", +"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp": "2026-02-07 17:17:34 -0700", "tests/library_checker_aizu_tests/data_structures/simple_tree_line.test.cpp": "2026-01-28 21:53:13 -0700", "tests/library_checker_aizu_tests/flow/dinic_aizu.test.cpp": "2024-11-17 14:04:03 -0600", "tests/library_checker_aizu_tests/flow/hungarian.test.cpp": "2024-11-17 14:04:03 -0600", From abdb86b64b4a15881d41b325f320f318670cdaf6 Mon Sep 17 00:00:00 2001 From: Luke Videckis Date: Sat, 7 Feb 2026 17:20:16 -0700 Subject: [PATCH 24/27] Fix formatting of if statement in test code --- .../data_structures/simple_tree_inc_walk.test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp b/tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp index 1ca26a19..e2e8c687 100644 --- a/tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp @@ -25,7 +25,7 @@ int main() { int idx = st.walk(k, n - 1, [&](int sum) { return sum == 0; }); - if(idx == n) idx = -1; + if (idx == n) idx = -1; cout << idx << '\n'; } else { assert(type == 4); From 827ed32e25a3c2aae556512cfeba6a104d6c6450 Mon Sep 17 00:00:00 2001 From: GitHub Date: Sun, 8 Feb 2026 00:21:50 +0000 Subject: [PATCH 25/27] [auto-verifier] verify commit abdb86b64b4a15881d41b325f320f318670cdaf6 --- .verify-helper/timestamps.remote.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.verify-helper/timestamps.remote.json b/.verify-helper/timestamps.remote.json index a073ab22..ce571b08 100644 --- a/.verify-helper/timestamps.remote.json +++ b/.verify-helper/timestamps.remote.json @@ -46,7 +46,7 @@ "tests/library_checker_aizu_tests/data_structures/simple_tree.test.cpp": "2026-01-28 21:53:13 -0700", "tests/library_checker_aizu_tests/data_structures/simple_tree_inc.test.cpp": "2026-02-07 17:15:13 -0700", "tests/library_checker_aizu_tests/data_structures/simple_tree_inc_line.test.cpp": "2026-02-07 17:15:13 -0700", -"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp": "2026-02-07 17:17:34 -0700", +"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp": "2026-02-07 17:20:16 -0700", "tests/library_checker_aizu_tests/data_structures/simple_tree_line.test.cpp": "2026-01-28 21:53:13 -0700", "tests/library_checker_aizu_tests/flow/dinic_aizu.test.cpp": "2024-11-17 14:04:03 -0600", "tests/library_checker_aizu_tests/flow/hungarian.test.cpp": "2024-11-17 14:04:03 -0600", From 7949f3366b38b90cacb049f73fe56999bf31e188 Mon Sep 17 00:00:00 2001 From: Luke Videckis Date: Sat, 7 Feb 2026 17:42:33 -0700 Subject: [PATCH 26/27] format --- .../data_structures/simple_tree_inc_walk.test.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp b/tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp index e2e8c687..50c2ea3f 100644 --- a/tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp @@ -22,9 +22,8 @@ int main() { cout << st.query(k, k) << '\n'; } else if (type == 3) { // returns first element in [k,n-1] such that sum > 0 - int idx = st.walk(k, n - 1, [&](int sum) { - return sum == 0; - }); + int idx = st.walk(k, n - 1, + [&](int sum) { return sum == 0; }); if (idx == n) idx = -1; cout << idx << '\n'; } else { From b19e3d68ad60aa7d5e0ae20e0e54f39de09542a5 Mon Sep 17 00:00:00 2001 From: GitHub Date: Sun, 8 Feb 2026 00:44:58 +0000 Subject: [PATCH 27/27] [auto-verifier] verify commit 7949f3366b38b90cacb049f73fe56999bf31e188 --- .verify-helper/timestamps.remote.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.verify-helper/timestamps.remote.json b/.verify-helper/timestamps.remote.json index ce571b08..f91831a4 100644 --- a/.verify-helper/timestamps.remote.json +++ b/.verify-helper/timestamps.remote.json @@ -46,7 +46,7 @@ "tests/library_checker_aizu_tests/data_structures/simple_tree.test.cpp": "2026-01-28 21:53:13 -0700", "tests/library_checker_aizu_tests/data_structures/simple_tree_inc.test.cpp": "2026-02-07 17:15:13 -0700", "tests/library_checker_aizu_tests/data_structures/simple_tree_inc_line.test.cpp": "2026-02-07 17:15:13 -0700", -"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp": "2026-02-07 17:20:16 -0700", +"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_walk.test.cpp": "2026-02-07 17:42:33 -0700", "tests/library_checker_aizu_tests/data_structures/simple_tree_line.test.cpp": "2026-01-28 21:53:13 -0700", "tests/library_checker_aizu_tests/flow/dinic_aizu.test.cpp": "2024-11-17 14:04:03 -0600", "tests/library_checker_aizu_tests/flow/hungarian.test.cpp": "2024-11-17 14:04:03 -0600",