Skip to content

Commit fd72bf4

Browse files
committed
Merge branch 'dev' into ten_second_time_limit
2 parents 6c08ade + 94f95ce commit fd72bf4

File tree

72 files changed

+419
-537
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+419
-537
lines changed

.verify-helper/timestamps.remote.json

Lines changed: 16 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -4,83 +4,41 @@
44
"tests/library_checker_aizu_tests/convolution/min_plus_convolution.test.cpp": "2024-11-17 14:04:03 -0600",
55
"tests/library_checker_aizu_tests/data_structures/binary_search_example.test.cpp": "2024-11-18 10:51:39 -0600",
66
"tests/library_checker_aizu_tests/data_structures/binary_trie.test.cpp": "2024-11-17 14:04:03 -0600",
7-
"tests/library_checker_aizu_tests/data_structures/bit.test.cpp": "2024-12-05 10:41:42 -0600",
7+
"tests/library_checker_aizu_tests/data_structures/bit.test.cpp": "2024-12-14 19:50:29 -0600",
88
"tests/library_checker_aizu_tests/data_structures/bit_inc.test.cpp": "2024-11-18 09:44:22 -0600",
99
"tests/library_checker_aizu_tests/data_structures/bit_ordered_set.test.cpp": "2024-12-10 11:52:04 -0600",
1010
"tests/library_checker_aizu_tests/data_structures/bit_rupq.test.cpp": "2024-12-05 10:41:42 -0600",
1111
"tests/library_checker_aizu_tests/data_structures/bit_rurq.test.cpp": "2024-12-05 10:41:42 -0600",
12-
"tests/library_checker_aizu_tests/data_structures/bit_walk.test.cpp": "2024-12-05 10:41:42 -0600",
13-
"tests/library_checker_aizu_tests/data_structures/deque.test.cpp": "2024-12-05 10:41:42 -0600",
14-
"tests/library_checker_aizu_tests/data_structures/deque_op.test.cpp": "2024-12-05 10:41:42 -0600",
15-
"tests/library_checker_aizu_tests/data_structures/deque_sliding_window.test.cpp": "2024-12-05 10:41:42 -0600",
16-
"tests/library_checker_aizu_tests/data_structures/disjoint_rmq_inc.test.cpp": "2024-12-05 10:41:42 -0600",
17-
"tests/library_checker_aizu_tests/data_structures/disjoint_rmq_inc_lines.test.cpp": "2024-12-05 10:41:42 -0600",
18-
"tests/library_checker_aizu_tests/data_structures/disjoint_rmq_lines.test.cpp": "2024-12-05 10:41:42 -0600",
19-
"tests/library_checker_aizu_tests/data_structures/disjoint_rmq_sum.test.cpp": "2024-12-05 10:41:42 -0600",
12+
"tests/library_checker_aizu_tests/data_structures/bit_walk.test.cpp": "2024-12-14 19:50:29 -0600",
13+
"tests/library_checker_aizu_tests/data_structures/deque.test.cpp": "2024-12-14 15:47:13 -0600",
14+
"tests/library_checker_aizu_tests/data_structures/deque_op.test.cpp": "2024-12-14 19:50:29 -0600",
15+
"tests/library_checker_aizu_tests/data_structures/deque_sliding_window.test.cpp": "2024-12-14 15:47:13 -0600",
16+
"tests/library_checker_aizu_tests/data_structures/disjoint_rmq_inc.test.cpp": "2024-12-14 15:47:13 -0600",
17+
"tests/library_checker_aizu_tests/data_structures/disjoint_rmq_inc_lines.test.cpp": "2024-12-14 15:47:13 -0600",
18+
"tests/library_checker_aizu_tests/data_structures/disjoint_rmq_lines.test.cpp": "2024-12-14 15:47:13 -0600",
19+
"tests/library_checker_aizu_tests/data_structures/disjoint_rmq_sum.test.cpp": "2024-12-14 15:47:13 -0600",
2020
"tests/library_checker_aizu_tests/data_structures/distinct_query.test.cpp": "2024-12-05 10:41:42 -0600",
21-
"tests/library_checker_aizu_tests/data_structures/dsu_bipartite.test.cpp": "2024-11-17 14:04:03 -0600",
21+
"tests/library_checker_aizu_tests/data_structures/dsu_bipartite.test.cpp": "2024-12-14 19:50:29 -0600",
2222
"tests/library_checker_aizu_tests/data_structures/dsu_restorable.test.cpp": "2024-11-17 14:04:03 -0600",
23-
"tests/library_checker_aizu_tests/data_structures/dsu_segtree_undo_trick.test.cpp": "2024-12-05 10:41:42 -0600",
24-
"tests/library_checker_aizu_tests/data_structures/implicit_seg_tree.test.cpp": "2024-12-10 12:06:44 -0600",
2523
"tests/library_checker_aizu_tests/data_structures/kruskal_tree_aizu.test.cpp": "2024-11-17 14:04:03 -0600",
2624
"tests/library_checker_aizu_tests/data_structures/kth_smallest_pst.test.cpp": "2024-12-05 10:41:42 -0600",
2725
"tests/library_checker_aizu_tests/data_structures/kth_smallest_wavelet_matrix.test.cpp": "2024-11-19 08:31:51 -0600",
28-
"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree.test.cpp": "2024-12-05 10:41:42 -0600",
29-
"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_constructor.test.cpp": "2024-12-05 10:41:42 -0600",
26+
"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree.test.cpp": "2024-12-14 19:50:29 -0600",
27+
"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_constructor.test.cpp": "2024-12-14 19:50:29 -0600",
3028
"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_inc.test.cpp": "2024-12-05 10:41:42 -0600",
3129
"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_inc_constructor.test.cpp": "2024-12-05 10:41:42 -0600",
3230
"tests/library_checker_aizu_tests/data_structures/line_tree_aizu.test.cpp": "2024-12-05 10:41:42 -0600",
3331
"tests/library_checker_aizu_tests/data_structures/line_tree_lib_checker.test.cpp": "2024-11-17 14:04:03 -0600",
3432
"tests/library_checker_aizu_tests/data_structures/merge_sort_tree.test.cpp": "2024-11-17 14:04:03 -0600",
3533
"tests/library_checker_aizu_tests/data_structures/mode_query.test.cpp": "2024-12-05 10:41:42 -0600",
36-
"tests/library_checker_aizu_tests/data_structures/permutation_tree.test.cpp": "2024-12-05 10:41:42 -0600",
34+
"tests/library_checker_aizu_tests/data_structures/permutation_tree.test.cpp": "2024-12-14 15:47:13 -0600",
3735
"tests/library_checker_aizu_tests/data_structures/persistent_queue_tree.test.cpp": "2024-12-05 10:41:42 -0600",
3836
"tests/library_checker_aizu_tests/data_structures/persistent_seg_tree.test.cpp": "2024-12-05 10:41:42 -0600",
3937
"tests/library_checker_aizu_tests/data_structures/pq_ds_undo_sliding_window.test.cpp": "2024-12-05 10:41:42 -0600",
4038
"tests/library_checker_aizu_tests/data_structures/pq_ds_undo_with_dsu.test.cpp": "2024-12-05 10:41:42 -0600",
41-
"tests/library_checker_aizu_tests/data_structures/range_parallel_dsu.test.cpp": "2024-12-10 20:34:52 -0600",
42-
"tests/library_checker_aizu_tests/data_structures/rmq_disjoint_sparse_table.test.cpp": "2024-12-10 11:44:08 -0600",
43-
"tests/library_checker_aizu_tests/data_structures/rmq_linear.test.cpp": "2024-12-12 12:25:13 -0600",
44-
"tests/library_checker_aizu_tests/data_structures/rmq_sparse_table.test.cpp": "2024-12-12 12:25:13 -0600",
45-
"tests/library_checker_aizu_tests/data_structures/rmq_sparse_table_inc.test.cpp": "2024-12-12 12:25:13 -0600",
46-
"tests/library_checker_aizu_tests/data_structures/simple_tree.test.cpp": "2024-12-06 01:57:17 -0600",
47-
"tests/library_checker_aizu_tests/data_structures/simple_tree_inc.test.cpp": "2024-12-06 01:57:17 -0600",
48-
"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_line.test.cpp": "2024-12-06 01:57:17 -0600",
49-
"tests/library_checker_aizu_tests/data_structures/simple_tree_line.test.cpp": "2024-12-06 01:57:17 -0600",
5039
"tests/library_checker_aizu_tests/flow/dinic_aizu.test.cpp": "2024-11-17 14:04:03 -0600",
5140
"tests/library_checker_aizu_tests/flow/hungarian.test.cpp": "2024-11-17 14:04:03 -0600",
5241
"tests/library_checker_aizu_tests/flow/min_cost_max_flow.test.cpp": "2024-12-05 10:41:42 -0600",
53-
"tests/library_checker_aizu_tests/graphs/biconnected_components.test.cpp": "2024-11-17 14:04:03 -0600",
54-
"tests/library_checker_aizu_tests/graphs/connected_components_of_complement_graph.test.cpp": "2024-11-17 14:04:03 -0600",
55-
"tests/library_checker_aizu_tests/graphs/dijkstra_aizu.test.cpp": "2024-11-17 14:04:03 -0600",
56-
"tests/library_checker_aizu_tests/graphs/dijkstra_lib_checker.test.cpp": "2024-11-17 14:04:03 -0600",
57-
"tests/library_checker_aizu_tests/graphs/directed_cycle.test.cpp": "2024-12-14 13:29:53 -0600",
58-
"tests/library_checker_aizu_tests/graphs/enumerate_triangles.test.cpp": "2024-11-17 14:04:03 -0600",
59-
"tests/library_checker_aizu_tests/graphs/hopcroft_karp_aizu.test.cpp": "2024-11-19 11:51:33 -0600",
60-
"tests/library_checker_aizu_tests/graphs/hopcroft_karp_lib_checker.test.cpp": "2024-11-19 11:51:33 -0600",
61-
"tests/library_checker_aizu_tests/graphs/mst.test.cpp": "2024-11-17 14:04:03 -0600",
62-
"tests/library_checker_aizu_tests/graphs/offline_incremental_scc.test.cpp": "2024-12-14 13:29:53 -0600",
63-
"tests/library_checker_aizu_tests/graphs/strongly_connected_components_aizu.test.cpp": "2024-12-14 13:29:53 -0600",
64-
"tests/library_checker_aizu_tests/graphs/strongly_connected_components_lib_checker.test.cpp": "2024-12-14 13:29:53 -0600",
65-
"tests/library_checker_aizu_tests/graphs/two_edge_components.test.cpp": "2024-11-17 14:04:03 -0600",
66-
"tests/library_checker_aizu_tests/handmade_tests/count_paths_forest.test.cpp": "2024-12-13 15:23:04 -0600",
67-
"tests/library_checker_aizu_tests/handmade_tests/dsu_size.test.cpp": "2024-11-17 14:04:03 -0600",
68-
"tests/library_checker_aizu_tests/handmade_tests/dynamic_bitset.test.cpp": "2024-11-22 10:47:44 -0600",
69-
"tests/library_checker_aizu_tests/handmade_tests/edge_cd_small_trees.test.cpp": "2024-12-10 12:27:45 -0600",
70-
"tests/library_checker_aizu_tests/handmade_tests/fib_matrix_expo.test.cpp": "2024-11-17 14:04:03 -0600",
71-
"tests/library_checker_aizu_tests/handmade_tests/functional_graph.test.cpp": "2024-12-10 12:28:47 -0600",
72-
"tests/library_checker_aizu_tests/handmade_tests/lca_ladder_forest.test.cpp": "2024-12-05 10:41:42 -0600",
73-
"tests/library_checker_aizu_tests/handmade_tests/manacher.test.cpp": "2024-12-05 10:41:42 -0600",
74-
"tests/library_checker_aizu_tests/handmade_tests/merge_st_and_wavelet.test.cpp": "2024-11-19 08:31:51 -0600",
75-
"tests/library_checker_aizu_tests/handmade_tests/mobius.test.cpp": "2024-12-10 12:31:07 -0600",
76-
"tests/library_checker_aizu_tests/handmade_tests/mod_int.test.cpp": "2024-11-17 14:04:03 -0600",
77-
"tests/library_checker_aizu_tests/handmade_tests/n_choose_k.test.cpp": "2024-11-17 14:04:03 -0600",
78-
"tests/library_checker_aizu_tests/handmade_tests/permutation_tree_small.test.cpp": "2024-12-05 10:41:42 -0600",
79-
"tests/library_checker_aizu_tests/handmade_tests/rmq_small_n.test.cpp": "2024-12-05 10:41:42 -0600",
80-
"tests/library_checker_aizu_tests/handmade_tests/sa_find_subarray.test.cpp": "2024-12-08 12:47:08 -0600",
81-
"tests/library_checker_aizu_tests/handmade_tests/seg_tree_find.test.cpp": "2024-12-05 10:41:42 -0600",
82-
"tests/library_checker_aizu_tests/handmade_tests/seg_tree_find_small.test.cpp": "2024-12-05 10:41:42 -0600",
83-
"tests/library_checker_aizu_tests/handmade_tests/string_with_vector.test.cpp": "2024-12-08 12:47:08 -0600",
8442
"tests/library_checker_aizu_tests/loops/chooses.test.cpp": "2024-11-17 14:04:03 -0600",
8543
"tests/library_checker_aizu_tests/loops/quotients.test.cpp": "2024-11-17 14:04:03 -0600",
8644
"tests/library_checker_aizu_tests/loops/submasks.test.cpp": "2024-11-17 14:04:03 -0600",
@@ -89,7 +47,7 @@
8947
"tests/library_checker_aizu_tests/math/binary_matrix_mult.test.cpp": "2024-11-17 14:04:03 -0600",
9048
"tests/library_checker_aizu_tests/math/count_paths.test.cpp": "2024-12-10 20:34:52 -0600",
9149
"tests/library_checker_aizu_tests/math/derangement.test.cpp": "2024-11-17 14:04:03 -0600",
92-
"tests/library_checker_aizu_tests/math/matrix_determinant.test.cpp": "2024-11-17 14:04:03 -0600",
50+
"tests/library_checker_aizu_tests/math/matrix_determinant.test.cpp": "2024-12-14 15:47:13 -0600",
9351
"tests/library_checker_aizu_tests/math/matrix_mult.test.cpp": "2024-11-17 14:04:03 -0600",
9452
"tests/library_checker_aizu_tests/math/mod_int_derangement.test.cpp": "2024-11-17 14:04:03 -0600",
9553
"tests/library_checker_aizu_tests/math/mod_int_gcd_convolution.test.cpp": "2024-11-17 14:04:03 -0600",
@@ -99,40 +57,10 @@
9957
"tests/library_checker_aizu_tests/math/num_subsequences.test.cpp": "2024-11-17 14:04:03 -0600",
10058
"tests/library_checker_aizu_tests/math/partitions.test.cpp": "2024-11-17 14:04:03 -0600",
10159
"tests/library_checker_aizu_tests/math/prime_sieve.test.cpp": "2024-11-22 11:54:52 -0600",
102-
"tests/library_checker_aizu_tests/math/solve_linear_mod.test.cpp": "2024-11-17 14:04:03 -0600",
60+
"tests/library_checker_aizu_tests/math/solve_linear_mod.test.cpp": "2024-12-14 15:47:13 -0600",
10361
"tests/library_checker_aizu_tests/math/tetration.test.cpp": "2024-11-17 14:04:03 -0600",
10462
"tests/library_checker_aizu_tests/math/totient.test.cpp": "2024-11-17 14:04:03 -0600",
105-
"tests/library_checker_aizu_tests/monotonic_stack_related/cartesian_binary_tree.test.cpp": "2024-11-17 14:04:03 -0600",
106-
"tests/library_checker_aizu_tests/monotonic_stack_related/cartesian_k_ary_tree.test.cpp": "2024-12-12 12:25:13 -0600",
107-
"tests/library_checker_aizu_tests/monotonic_stack_related/count_rectangles.test.cpp": "2024-12-12 12:25:13 -0600",
108-
"tests/library_checker_aizu_tests/monotonic_stack_related/max_rect_histogram.test.cpp": "2024-12-12 12:25:13 -0600",
109-
"tests/library_checker_aizu_tests/strings/kmp.test.cpp": "2024-12-05 10:41:42 -0600",
110-
"tests/library_checker_aizu_tests/strings/lcp_array.test.cpp": "2024-11-22 12:15:07 -0600",
111-
"tests/library_checker_aizu_tests/strings/lcp_query_palindrome.test.cpp": "2024-12-08 12:47:08 -0600",
112-
"tests/library_checker_aizu_tests/strings/lcp_query_zfunc.test.cpp": "2024-12-08 12:47:08 -0600",
11363
"tests/library_checker_aizu_tests/strings/lcs_dp.test.cpp": "2024-12-05 10:41:42 -0600",
114-
"tests/library_checker_aizu_tests/strings/lcs_queries.test.cpp": "2024-12-05 10:41:42 -0600",
64+
"tests/library_checker_aizu_tests/strings/lcs_queries.test.cpp": "2024-12-14 19:50:29 -0600",
11565
"tests/library_checker_aizu_tests/strings/lcs_queries_merge_sort_tree.test.cpp": "2024-12-05 10:41:42 -0600",
116-
"tests/library_checker_aizu_tests/strings/longest_common_substring.test.cpp": "2024-12-08 12:47:08 -0600",
117-
"tests/library_checker_aizu_tests/strings/manacher.test.cpp": "2024-11-17 14:04:03 -0600",
118-
"tests/library_checker_aizu_tests/strings/multi_matching_bs.test.cpp": "2024-12-08 12:47:08 -0600",
119-
"tests/library_checker_aizu_tests/strings/prefix_function.test.cpp": "2024-11-17 14:04:03 -0600",
120-
"tests/library_checker_aizu_tests/strings/sa_cmp.test.cpp": "2024-12-08 12:47:08 -0600",
121-
"tests/library_checker_aizu_tests/strings/sa_sort_pairs.test.cpp": "2024-12-08 12:47:08 -0600",
122-
"tests/library_checker_aizu_tests/strings/single_matching_bs.test.cpp": "2024-12-08 12:47:08 -0600",
123-
"tests/library_checker_aizu_tests/strings/suffix_array.test.cpp": "2024-12-12 12:25:13 -0600",
124-
"tests/library_checker_aizu_tests/strings/suffix_array_short.test.cpp": "2024-11-22 12:15:07 -0600",
125-
"tests/library_checker_aizu_tests/strings/trie.test.cpp": "2024-12-05 10:41:42 -0600",
126-
"tests/library_checker_aizu_tests/strings/wildcard_pattern_matching.test.cpp": "2024-11-17 14:04:03 -0600",
127-
"tests/library_checker_aizu_tests/trees/count_paths_per_length.test.cpp": "2024-12-13 15:18:46 -0600",
128-
"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_query.test.cpp": "2024-12-05 10:41:42 -0600",
129-
"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_update.test.cpp": "2024-12-05 10:41:42 -0600",
130-
"tests/library_checker_aizu_tests/trees/edge_cd_count_paths_per_length.test.cpp": "2024-12-13 15:18:46 -0600",
131-
"tests/library_checker_aizu_tests/trees/edge_cd_reroot_dp.test.cpp": "2024-12-05 10:41:42 -0600",
132-
"tests/library_checker_aizu_tests/trees/kth_path_ladder.test.cpp": "2024-12-13 12:47:51 -0600",
133-
"tests/library_checker_aizu_tests/trees/kth_path_linear.test.cpp": "2024-12-13 12:53:13 -0600",
134-
"tests/library_checker_aizu_tests/trees/kth_path_tree_lift.test.cpp": "2024-12-13 12:53:13 -0600",
135-
"tests/library_checker_aizu_tests/trees/lca_all_methods_aizu.test.cpp": "2024-12-05 10:41:42 -0600",
136-
"tests/library_checker_aizu_tests/trees/lca_all_methods_lib_checker.test.cpp": "2024-12-05 10:41:42 -0600",
137-
"tests/library_checker_aizu_tests/trees/subtree_isomorphism.test.cpp": "2024-12-12 12:49:00 -0600"
13866
}

library/contest/random.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
//! uint64_t x1 = rng();
66
//! mt19937 rng; // fixed seed for debugging
77
//! int x2 = rnd(0, 1); //random number in [0,1]
8-
//! ll x3 = rnd<ll>(1, 1e18);
8+
//! ll x3 = rnd(ll(1), ll(1e18));
99
//! @endcode
1010
mt19937 rng(
1111
chrono::steady_clock::now().time_since_epoch().count());
12-
template<class T> T rnd(T l, T r) {
12+
auto rnd(auto l, auto r) {
1313
assert(l <= r);
14-
return uniform_int_distribution<T>(l, r)(rng);
14+
return uniform_int_distribution(l, r)(rng);
1515
}

library/data_structures/deque_op/queue_only.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22
//! https://github.com/suisen-cp/cp-library-cpp/blob/main/library/datastructure/deque_aggregation.hpp
33
//! @code
4-
//! deq dq(a, [](auto x, auto y) {return min(x, y);});
4+
//! deq dq(a, ranges::min);
55
//! @endcode
66
//! @time operations are O(1) ammortized
77
//! @space O(n)

library/data_structures/dsu/range_parallel_dsu.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,14 @@
88
struct rp_dsu {
99
vector<UF> ufs;
1010
rp_dsu(int n): ufs(bit_width(unsigned(n)), UF(n)) {}
11-
template<class F>
12-
void join(int l1, int l2, int len, const F& f) {
11+
void join(int l1, int l2, int len, const auto& f) {
1312
if (len == 0) return;
1413
int lg = __lg(len);
1514
join_impl(lg, l1, l2, f);
1615
join_impl(lg, l1 + len - (1 << lg),
1716
l2 + len - (1 << lg), f);
1817
}
19-
template<class F>
20-
void join_impl(int lvl, int u, int v, const F& f) {
18+
void join_impl(int lvl, int u, int v, const auto& f) {
2119
if (lvl == 0) {
2220
u = ufs[0].find(u);
2321
v = ufs[0].find(v);

library/data_structures/rmq_inc.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#pragma once
22
//! @code
3-
//! rmq_inc rmq3(a, ranges::min);
4-
//! rmq_inc rmq4(a, [&](auto& x, auto& y) {
3+
//! rmq_inc rmq1(a, ranges::min);
4+
//! rmq_inc rmq2(a, [&](auto& x, auto& y) {
55
//! return min(x, y);
66
//! });
77
//! vector<rmq_inc<int, function<int(int, int)>>>
8-
//! rmqs2(3, {{}, NULL});
9-
//! rmqs2[1] = {a, ranges::min};
8+
//! rmqs(3, {{}, NULL});
9+
//! rmqs[1] = {a, ranges::min};
1010
//! @endcode
1111
//! @time O(nlogn + q)
1212
//! @space O(nlogn)

library/data_structures/seg_tree.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#pragma once
22
//! https://github.com/kth-competitive-programming/kactl/blob/main/content/data-structures/SegmentTree.h
33
//! @code
4-
//! tree st0(n, INT_MAX, ranges::min);
5-
//! tree st(n, INT_MAX, [&](int x, int y) -> int {
4+
//! tree st1(n, INT_MAX, ranges::min);
5+
//! tree st2(n, INT_MAX, [&](int x, int y) -> int {
66
//! return min(x, y);
77
//! });
88
//! @endcode

library/data_structures/seg_tree_inc.hpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
#pragma once
22
//! https://codeforces.com/blog/entry/118682
33
//! @code
4-
//! tree_inc st3(n, int{}, ranges::min);
5-
//! tree_inc st4(n, pii{}, [&](pii x, pii y) -> pii {
6-
//! return min(x, y);
7-
//! });
8-
//! rep(i, 0, n) st3.update(i, a[i]);
4+
//! tree_inc st(n, int{}, ranges::min);
5+
//! rep(i, 0, n) st.update(i, a[i]);
96
//! @endcode
107
//! @time O(n + q log n)
118
//! @space O(n)

library/data_structures/seg_tree_uncommon/find_first.hpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22
//! @code
3-
//! seg_tree st1(n);
4-
//! st1.find_first(l, r, [&](ll x, int tl, int tr) ->
3+
//! seg_tree st(n);
4+
//! st.find_first(l, r, [&](ll x, int tl, int tr) ->
55
//! bool {
66
//! });
77
//! @endcode
@@ -25,13 +25,11 @@
2525
//! such element exists then `r` is returned
2626
//! @time O(log(n))
2727
//! @space O(log(n)) for recursion stack
28-
template<class F>
29-
int find_first(int l, int r, const F& f) {
28+
int find_first(int l, int r, const auto& f) {
3029
return find_first_in_range(l, r, f, 0, n, 1);
3130
}
3231
//! invariant: f(tree[v], tl, tr) is 1
33-
template<class F>
34-
int find_first_in_subtree(const F& f, int tl, int tr,
32+
int find_first_in_subtree(const auto& f, int tl, int tr,
3533
int v) {
3634
if (v >= n) return tl;
3735
int tm = split(tl, tr);
@@ -40,9 +38,8 @@ int find_first_in_subtree(const F& f, int tl, int tr,
4038
return find_first_in_subtree(f, tl, tm, 2 * v);
4139
return find_first_in_subtree(f, tm, tr, 2 * v + 1);
4240
}
43-
template<class F>
44-
int find_first_in_range(int l, int r, const F& f, int tl,
45-
int tr, int v) {
41+
int find_first_in_range(int l, int r, const auto& f,
42+
int tl, int tr, int v) {
4643
if (r <= tl || tr <= l) return r;
4744
if (l <= tl && tr <= r)
4845
return f(tree[v], tl, tr)

library/data_structures/seg_tree_uncommon/find_last.hpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22
//! @code
3-
//! seg_tree st2(n);
4-
//! st2.find_last(l, r, [&](ll x, int tl, int tr) ->
3+
//! seg_tree st(n);
4+
//! st.find_last(l, r, [&](ll x, int tl, int tr) ->
55
//! bool {
66
//! });
77
//! @endcode
@@ -25,12 +25,11 @@
2525
//! such element exists then (l - 1) is returned
2626
//! @time O(log(n))
2727
//! @space O(log(n)) for recursion stack
28-
template<class F> int find_last(int l, int r, const F& f) {
28+
int find_last(int l, int r, const auto& f) {
2929
return find_last_in_range(l, r, f, 0, n, 1);
3030
}
3131
//! invariant: f(tree[v], tl, tr) is 1
32-
template<class F>
33-
int find_last_in_subtree(const F& f, int tl, int tr,
32+
int find_last_in_subtree(const auto& f, int tl, int tr,
3433
int v) {
3534
if (v >= n) return tl;
3635
int tm = split(tl, tr);
@@ -39,8 +38,7 @@ int find_last_in_subtree(const F& f, int tl, int tr,
3938
return find_last_in_subtree(f, tm, tr, 2 * v + 1);
4039
return find_last_in_subtree(f, tl, tm, 2 * v);
4140
}
42-
template<class F>
43-
int find_last_in_range(int l, int r, const F& f, int tl,
41+
int find_last_in_range(int l, int r, const auto& f, int tl,
4442
int tr, int v) {
4543
if (r <= tl || tr <= l) return l - 1;
4644
if (l <= tl && tr <= r)

0 commit comments

Comments
 (0)