Skip to content
Merged

Test #170

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
34 changes: 17 additions & 17 deletions .verify-helper/timestamps.remote.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,39 @@
"tests/library_checker_aizu_tests/convolution/min_plus_convolution.test.cpp": "2024-11-17 14:04:03 -0600",
"tests/library_checker_aizu_tests/data_structures/binary_search_example.test.cpp": "2024-11-18 10:51:39 -0600",
"tests/library_checker_aizu_tests/data_structures/binary_trie.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/bit.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/bit.test.cpp": "2026-01-18 03:03:57 -0700",
"tests/library_checker_aizu_tests/data_structures/bit_inc.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/bit_ordered_set.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/bit_rupq.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/bit_rurq.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/bit_walk.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/bit_walk.test.cpp": "2026-01-18 03:03:57 -0700",
"tests/library_checker_aizu_tests/data_structures/deque.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/deque_index.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/deque_op.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/deque_sliding_window.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/disjoint_rmq_inc.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/disjoint_rmq_inc_lines.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/disjoint_rmq_inc_sum.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/distinct_query.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/distinct_query.test.cpp": "2026-01-18 03:05:20 -0700",
"tests/library_checker_aizu_tests/data_structures/dsu.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/dsu_bipartite.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/dsu_restorable.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/dsu_segtree_undo_trick.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/dsu_segtree_undo_trick.test.cpp": "2026-01-18 03:03:57 -0700",
"tests/library_checker_aizu_tests/data_structures/implicit_seg_tree.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/kruskal_tree_aizu.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/kth_smallest_pst.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/kth_smallest_pst.test.cpp": "2026-01-18 03:06:14 -0700",
"tests/library_checker_aizu_tests/data_structures/kth_smallest_wavelet_matrix.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_constructor.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_inc.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_inc_constructor.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree.test.cpp": "2026-01-18 03:03:57 -0700",
"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_constructor.test.cpp": "2026-01-18 03:03:57 -0700",
"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_inc.test.cpp": "2026-01-18 02:59:09 -0700",
"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_inc_constructor.test.cpp": "2026-01-18 02:59:09 -0700",
"tests/library_checker_aizu_tests/data_structures/line_tree_aizu.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/line_tree_lib_checker.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/merge_sort_tree.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/merge_sort_tree.test.cpp": "2026-01-18 03:06:56 -0700",
"tests/library_checker_aizu_tests/data_structures/mode_query.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/permutation_tree.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/persistent_queue_tree.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/persistent_seg_tree.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/persistent_queue_tree.test.cpp": "2026-01-18 03:05:20 -0700",
"tests/library_checker_aizu_tests/data_structures/persistent_seg_tree.test.cpp": "2026-01-18 03:05:20 -0700",
"tests/library_checker_aizu_tests/data_structures/pq_ds_undo_sliding_window.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/pq_ds_undo_with_dsu.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/data_structures/range_parallel_dsu.test.cpp": "2026-01-18 02:20:40 +0000",
Expand Down Expand Up @@ -75,15 +75,15 @@
"tests/library_checker_aizu_tests/handmade_tests/functional_graph.test.cpp": "2025-08-06 16:18:37 -0600",
"tests/library_checker_aizu_tests/handmade_tests/hilbert_mos.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/handmade_tests/manacher.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/handmade_tests/merge_st_and_wavelet.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/handmade_tests/merge_st_and_wavelet.test.cpp": "2026-01-18 03:06:56 -0700",
"tests/library_checker_aizu_tests/handmade_tests/mobius.test.cpp": "2025-02-10 14:50:36 -0700",
"tests/library_checker_aizu_tests/handmade_tests/mod_division.test.cpp": "2025-09-07 16:12:35 -0600",
"tests/library_checker_aizu_tests/handmade_tests/n_choose_k.test.cpp": "2025-08-28 13:19:16 -0600",
"tests/library_checker_aizu_tests/handmade_tests/permutation_tree_small.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/handmade_tests/rmq_small_n.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/handmade_tests/sa_find_subarray.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/handmade_tests/seg_tree_find.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/handmade_tests/seg_tree_find_small.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/handmade_tests/seg_tree_find.test.cpp": "2026-01-18 03:03:57 -0700",
"tests/library_checker_aizu_tests/handmade_tests/seg_tree_find_small.test.cpp": "2026-01-18 03:03:57 -0700",
"tests/library_checker_aizu_tests/loops/chooses.test.cpp": "2025-02-10 14:50:36 -0700",
"tests/library_checker_aizu_tests/loops/quotients.test.cpp": "2024-11-17 14:04:03 -0600",
"tests/library_checker_aizu_tests/loops/submasks.test.cpp": "2025-02-10 14:50:36 -0700",
Expand Down Expand Up @@ -112,7 +112,7 @@
"tests/library_checker_aizu_tests/strings/lcp_query_zfunc.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/strings/lcs_dp.test.cpp": "2025-08-05 19:19:23 -0600",
"tests/library_checker_aizu_tests/strings/lcs_queries.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/strings/lcs_queries_merge_sort_tree.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/strings/lcs_queries_merge_sort_tree.test.cpp": "2026-01-18 03:06:56 -0700",
"tests/library_checker_aizu_tests/strings/manacher.test.cpp": "2025-08-05 19:19:23 -0600",
"tests/library_checker_aizu_tests/strings/multi_matching_bs.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/strings/prefix_function.test.cpp": "2025-08-05 19:19:23 -0600",
Expand All @@ -129,7 +129,7 @@
"tests/library_checker_aizu_tests/trees/edge_cd_count_paths_per_length.test.cpp": "2025-12-11 21:47:53 +0000",
"tests/library_checker_aizu_tests/trees/edge_cd_reroot_dp.test.cpp": "2025-09-07 15:50:55 -0600",
"tests/library_checker_aizu_tests/trees/hld_aizu1.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/trees/hld_aizu2.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/trees/hld_aizu2.test.cpp": "2026-01-18 03:03:57 -0700",
"tests/library_checker_aizu_tests/trees/hld_lib_checker_path.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/trees/hld_lib_checker_subtree_edges.test.cpp": "2026-01-18 02:20:40 +0000",
"tests/library_checker_aizu_tests/trees/hld_lib_checker_subtree_nodes.test.cpp": "2026-01-18 02:20:40 +0000",
Expand Down
16 changes: 8 additions & 8 deletions library/data_structures_[l,r)/lazy_seg_tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,29 @@ struct seg_tree {
}
}
void update(int l, int r, ll change) { // [l, r)
update_impl(l, r, change, 0, n, 1);
update(l, r, change, 0, n, 1);
}
void update_impl(int l, int r, ll change, int tl, int tr,
void update(int l, int r, ll change, int tl, int tr,
int v) {
if (r <= tl || tr <= l) return;
if (l <= tl && tr <= r)
return apply(change, tl, tr, v);
int tm = split(tl, tr);
push(tl, tm, tr, v);
update_impl(l, r, change, tl, tm, 2 * v);
update_impl(l, r, change, tm, tr, 2 * v + 1);
update(l, r, change, tl, tm, 2 * v);
update(l, r, change, tm, tr, 2 * v + 1);
tree[v] = op(tree[2 * v], tree[2 * v + 1]);
}
ll query(int l, int r) { // [l, r)
return query_impl(l, r, 0, n, 1);
return query(l, r, 0, n, 1);
}
ll query_impl(int l, int r, int tl, int tr, int v) {
ll query(int l, int r, int tl, int tr, int v) {
if (r <= tl || tr <= l) return 0;
if (l <= tl && tr <= r) return tree[v];
int tm = split(tl, tr);
push(tl, tm, tr, v);
return op(query_impl(l, r, tl, tm, 2 * v),
query_impl(l, r, tm, tr, 2 * v + 1));
return op(query(l, r, tl, tm, 2 * v),
query(l, r, tm, tr, 2 * v + 1));
}
#include "seg_tree_uncommon/find_first.hpp"
#include "seg_tree_uncommon/find_last.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ struct kth_smallest {
//! @space O(log(maxv - minv)) for recursion stack; no
//! new nodes are allocated
int query(int l, int r, int k) {
return query_impl(k, pst.root_l, pst.root_r,
pst.roots[l], pst.roots[r]);
return query(k, pst.root_l, pst.root_r, pst.roots[l],
pst.roots[r]);
}
int query_impl(int k, int tl, int tr, int vl, int vr) {
int query(int k, int tl, int tr, int vl, int vr) {
if (tr - tl == 1) return tl;
int tm = tl + (tr - tl) / 2;
int left_count = pst.tree[pst.tree[vr].lch].sum -
pst.tree[pst.tree[vl].lch].sum;
if (left_count >= k)
return query_impl(k, tl, tm, pst.tree[vl].lch,
return query(k, tl, tm, pst.tree[vl].lch,
pst.tree[vr].lch);
return query_impl(k - left_count, tm, tr,
pst.tree[vl].rch, pst.tree[vr].rch);
return query(k - left_count, tm, tr, pst.tree[vl].rch,
pst.tree[vr].rch);
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ struct merge_sort_tree {
//! @time O(log(n)^2)
//! @space O(1)
int query(int l, int r, int vl, int vr) {
return query_impl(l, r, vl, vr, 0, n, 1);
return query(l, r, vl, vr, 0, n, 1);
}
int query_impl(int l, int r, int vl, int vr, int tl,
int tr, int v) {
int query(int l, int r, int vl, int vr, int tl, int tr,
int v) {
if (r <= tl || tr <= l) return 0;
if (l <= tl && tr <= r)
return ranges::lower_bound(tree[v], vr) -
ranges::lower_bound(tree[v], vl);
int tm = split(tl, tr);
return query_impl(l, r, vl, vr, tl, tm, 2 * v) +
query_impl(l, r, vl, vr, tm, tr, 2 * v + 1);
return query(l, r, vl, vr, tl, tm, 2 * v) +
query(l, r, vl, vr, tm, tr, 2 * v + 1);
}
};
21 changes: 9 additions & 12 deletions library/data_structures_[l,r)/seg_tree_uncommon/persistent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,31 @@ struct PST {
root_l(root_l), root_r(root_r), roots(1),
tree(1, {0LL, 0, 0}) {}
void update(int idx, ll change, int version) {
roots.push_back(update_impl(idx, change, root_l,
root_r, roots[version]));
roots.push_back(
update(idx, change, root_l, root_r, roots[version]));
}
int update_impl(int idx, ll change, int tl, int tr,
int v) {
int update(int idx, ll change, int tl, int tr, int v) {
if (tr - tl == 1) {
tree.emplace_back(tree[v].sum + change, 0, 0);
return sz(tree) - 1;
}
int tm = tl + (tr - tl) / 2;
int lch = tree[v].lch;
int rch = tree[v].rch;
if (idx < tm)
lch = update_impl(idx, change, tl, tm, lch);
else rch = update_impl(idx, change, tm, tr, rch);
if (idx < tm) lch = update(idx, change, tl, tm, lch);
else rch = update(idx, change, tm, tr, rch);
tree.emplace_back(tree[lch].sum + tree[rch].sum, lch,
rch);
return sz(tree) - 1;
}
ll query(int l, int r, int version) { // [l, r)
return query_impl(l, r, root_l, root_r,
roots[version]);
return query(l, r, root_l, root_r, roots[version]);
}
ll query_impl(int l, int r, int tl, int tr, int v) {
ll query(int l, int r, int tl, int tr, int v) {
if (v == 0 || r <= tl || tr <= l) return 0;
if (l <= tl && tr <= r) return tree[v].sum;
int tm = tl + (tr - tl) / 2;
return query_impl(l, r, tl, tm, tree[v].lch) +
query_impl(l, r, tm, tr, tree[v].rch);
return query(l, r, tl, tm, tree[v].lch) +
query(l, r, tm, tr, tree[v].rch);
}
};
20 changes: 10 additions & 10 deletions library/data_structures_[l,r]/lazy_seg_tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,29 @@ struct seg_tree {
lazy[v] = 0;
}
}
void update(int l, int r, ll change) { // [l, r]
update_impl(l, r, change, 0, n - 1, 1);
void update(int l, int r, ll change) {
update(l, r, change, 0, n - 1, 1);
}
void update_impl(int l, int r, ll change, int tl, int tr,
void update(int l, int r, ll change, int tl, int tr,
int v) {
if (r < tl || tr < l) return;
if (l <= tl && tr <= r)
return apply(change, tl, tr, v);
int tm = split(tl, tr);
push(tl, tm, tr, v);
update_impl(l, r, change, tl, tm, 2 * v);
update_impl(l, r, change, tm + 1, tr, 2 * v + 1);
update(l, r, change, tl, tm, 2 * v);
update(l, r, change, tm + 1, tr, 2 * v + 1);
tree[v] = op(tree[2 * v], tree[2 * v + 1]);
}
ll query(int l, int r) { // [l, r]
return query_impl(l, r, 0, n - 1, 1);
ll query(int l, int r) {
return query(l, r, 0, n - 1, 1);
}
ll query_impl(int l, int r, int tl, int tr, int v) {
ll query(int l, int r, int tl, int tr, int v) {
if (r < tl || tr < l) return 0;
if (l <= tl && tr <= r) return tree[v];
int tm = split(tl, tr);
push(tl, tm, tr, v);
return op(query_impl(l, r, tl, tm, 2 * v),
query_impl(l, r, tm + 1, tr, 2 * v + 1));
return op(query(l, r, tl, tm, 2 * v),
query(l, r, tm + 1, tr, 2 * v + 1));
}
};
Loading