diff --git a/.verify-helper/timestamps.remote.json b/.verify-helper/timestamps.remote.json index faf64fbb..dbf074bf 100644 --- a/.verify-helper/timestamps.remote.json +++ b/.verify-helper/timestamps.remote.json @@ -1,7 +1,7 @@ { "tests/library_checker_aizu_tests/convolution/gcd_convolution.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/convolution/lcm_convolution.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/convolution/min_plus_convolution.test.cpp": "2026-07-06 13:10:16 -0700", +"tests/library_checker_aizu_tests/convolution/min_plus_convolution.test.cpp": "2026-07-06 22:52:18 -0700", "tests/library_checker_aizu_tests/convolution/xor_convolution.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/data_structures/binary_search_example.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/data_structures/binary_trie.test.cpp": "2026-07-06 11:00:20 -0700", @@ -30,7 +30,7 @@ "tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_inc_constructor.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/data_structures/merge_sort_tree.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/data_structures/mode_query.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/data_structures/permutation_tree.test.cpp": "2026-07-06 22:18:09 -0700", +"tests/library_checker_aizu_tests/data_structures/permutation_tree.test.cpp": "2026-07-07 09:17:02 -0700", "tests/library_checker_aizu_tests/data_structures/persistent_queue_tree.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/data_structures/persistent_seg_tree.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/data_structures/pq_ds_undo_sliding_window.test.cpp": "2026-07-06 13:10:16 -0700", @@ -49,39 +49,39 @@ "tests/library_checker_aizu_tests/dsu/dsu_bipartite.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/dsu/dsu_weighted_aizu.test.cpp": "2026-07-06 13:49:19 -0700", "tests/library_checker_aizu_tests/dsu/dsu_weighted_lib_checker.test.cpp": "2026-07-06 13:49:19 -0700", -"tests/library_checker_aizu_tests/dsu/kruskal_tree_aizu.test.cpp": "2026-07-06 22:18:09 -0700", +"tests/library_checker_aizu_tests/dsu/kruskal_tree_aizu.test.cpp": "2026-07-07 09:17:02 -0700", "tests/library_checker_aizu_tests/dsu/line_tree_aizu.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/dsu/line_tree_lib_checker.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/dsu/range_parallel_dsu.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/flow/hungarian.test.cpp": "2026-07-06 13:09:48 -0700", "tests/library_checker_aizu_tests/flow/min_cost_max_flow.test.cpp": "2026-04-06 14:41:55 -0600", -"tests/library_checker_aizu_tests/graphs/bcc_callback_aizu_bcc.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/graphs/bcc_callback_aizu_two_edge_cc.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/graphs/bcc_callback_lib_checker_bcc.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/graphs/bcc_callback_lib_checker_two_cc.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/graphs/biconnected_components.test.cpp": "2026-07-06 13:10:16 -0700", +"tests/library_checker_aizu_tests/graphs/bcc_callback_aizu_bcc.test.cpp": "2026-07-06 22:30:55 -0700", +"tests/library_checker_aizu_tests/graphs/bcc_callback_aizu_two_edge_cc.test.cpp": "2026-07-06 22:30:55 -0700", +"tests/library_checker_aizu_tests/graphs/bcc_callback_lib_checker_bcc.test.cpp": "2026-07-06 22:30:55 -0700", +"tests/library_checker_aizu_tests/graphs/bcc_callback_lib_checker_two_cc.test.cpp": "2026-07-06 22:30:55 -0700", +"tests/library_checker_aizu_tests/graphs/biconnected_components.test.cpp": "2026-07-06 22:30:55 -0700", "tests/library_checker_aizu_tests/graphs/connected_components_of_complement_graph.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/graphs/dijkstra_aizu.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/graphs/dijkstra_lib_checker.test.cpp": "2026-07-06 22:18:09 -0700", -"tests/library_checker_aizu_tests/graphs/directed_cycle.test.cpp": "2026-07-06 13:10:16 -0700", +"tests/library_checker_aizu_tests/graphs/dijkstra_lib_checker.test.cpp": "2026-07-07 09:17:02 -0700", +"tests/library_checker_aizu_tests/graphs/directed_cycle.test.cpp": "2026-07-06 22:30:55 -0700", "tests/library_checker_aizu_tests/graphs/enumerate_triangles.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/graphs/euler_walk_directed.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/graphs/euler_walk_undirected.test.cpp": "2026-07-06 13:10:16 -0700", +"tests/library_checker_aizu_tests/graphs/euler_walk_directed.test.cpp": "2026-07-06 22:30:55 -0700", +"tests/library_checker_aizu_tests/graphs/euler_walk_undirected.test.cpp": "2026-07-06 22:30:55 -0700", "tests/library_checker_aizu_tests/graphs/hopcroft_karp_aizu.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/graphs/hopcroft_karp_lib_checker.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/graphs/mst.test.cpp": "2026-07-06 13:09:48 -0700", -"tests/library_checker_aizu_tests/graphs/offline_incremental_scc.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/graphs/strongly_connected_components_aizu.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/graphs/strongly_connected_components_lib_checker.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/graphs/two_edge_components.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/handmade_tests/count_paths.test.cpp": "2026-07-06 22:18:09 -0700", -"tests/library_checker_aizu_tests/handmade_tests/dsu.test.cpp": "2026-07-06 22:18:09 -0700", -"tests/library_checker_aizu_tests/handmade_tests/edge_cd_small_trees.test.cpp": "2026-07-06 22:18:09 -0700", +"tests/library_checker_aizu_tests/graphs/offline_incremental_scc.test.cpp": "2026-07-06 22:30:55 -0700", +"tests/library_checker_aizu_tests/graphs/strongly_connected_components_aizu.test.cpp": "2026-07-06 22:30:55 -0700", +"tests/library_checker_aizu_tests/graphs/strongly_connected_components_lib_checker.test.cpp": "2026-07-06 22:30:55 -0700", +"tests/library_checker_aizu_tests/graphs/two_edge_components.test.cpp": "2026-07-06 22:30:55 -0700", +"tests/library_checker_aizu_tests/handmade_tests/count_paths.test.cpp": "2026-07-06 22:44:57 -0700", +"tests/library_checker_aizu_tests/handmade_tests/dsu.test.cpp": "2026-07-07 09:17:02 -0700", +"tests/library_checker_aizu_tests/handmade_tests/edge_cd_small_trees.test.cpp": "2026-07-06 22:30:55 -0700", "tests/library_checker_aizu_tests/handmade_tests/fib_matrix_expo.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/handmade_tests/functional_graph.test.cpp": "2026-07-06 22:43:37 -0700", "tests/library_checker_aizu_tests/handmade_tests/hilbert_mos.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/handmade_tests/kd_bit.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/handmade_tests/kth_par.test.cpp": "2026-07-06 13:10:16 -0700", +"tests/library_checker_aizu_tests/handmade_tests/kth_par.test.cpp": "2026-07-06 22:44:57 -0700", "tests/library_checker_aizu_tests/handmade_tests/manacher.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/handmade_tests/merge_st_and_wavelet.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/handmade_tests/mobius.test.cpp": "2026-07-06 13:10:16 -0700", @@ -92,7 +92,7 @@ "tests/library_checker_aizu_tests/handmade_tests/sa_find_subarray.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/handmade_tests/seg_tree_find.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/handmade_tests/seg_tree_find_small.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/handmade_tests/seg_tree_midpoint.test.cpp": "2026-07-06 22:18:09 -0700", +"tests/library_checker_aizu_tests/handmade_tests/seg_tree_midpoint.test.cpp": "2026-07-07 09:17:02 -0700", "tests/library_checker_aizu_tests/handmade_tests/xor_basis_walk.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/loops/chooses.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/loops/quotients.test.cpp": "2026-07-06 13:10:16 -0700", @@ -132,23 +132,23 @@ "tests/library_checker_aizu_tests/strings/suffix_array_short.test.cpp": "2026-04-12 06:15:25 -0600", "tests/library_checker_aizu_tests/strings/trie.test.cpp": "2026-07-06 13:10:16 -0700", "tests/library_checker_aizu_tests/strings/wildcard_pattern_matching.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/trees/cd_count_paths_per_length.test.cpp": "2026-07-06 22:18:09 -0700", -"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_query.test.cpp": "2026-07-06 22:43:37 -0700", -"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_update.test.cpp": "2026-07-06 22:43:37 -0700", -"tests/library_checker_aizu_tests/trees/edge_cd_count_paths_per_length.test.cpp": "2026-07-06 22:18:09 -0700", -"tests/library_checker_aizu_tests/trees/edge_cd_reroot_dp.test.cpp": "2026-07-06 22:18:09 -0700", -"tests/library_checker_aizu_tests/trees/hld_aizu1.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/trees/hld_aizu2.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/trees/hld_lib_checker_path.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/trees/hld_lib_checker_subtree_edges.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/trees/hld_lib_checker_subtree_nodes.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/trees/kth_path_hagerup.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/trees/kth_path_ladder.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/trees/kth_path_linear.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/trees/kth_path_tree_lift.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/trees/lca_all_methods_aizu.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/trees/lca_all_methods_lib_checker.test.cpp": "2026-07-06 13:10:16 -0700", -"tests/library_checker_aizu_tests/trees/shallowest_aizu_tree_height.test.cpp": "2026-07-06 22:18:09 -0700", -"tests/library_checker_aizu_tests/trees/shallowest_lib_checker_tree_path_composite.test.cpp": "2026-07-06 22:18:09 -0700", -"tests/library_checker_aizu_tests/trees/subtree_isomorphism.test.cpp": "2026-07-06 13:10:16 -0700" +"tests/library_checker_aizu_tests/trees/cd_count_paths_per_length.test.cpp": "2026-07-06 22:30:55 -0700", +"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_query.test.cpp": "2026-07-06 22:30:55 -0700", +"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_update.test.cpp": "2026-07-06 22:30:55 -0700", +"tests/library_checker_aizu_tests/trees/edge_cd_count_paths_per_length.test.cpp": "2026-07-06 22:30:55 -0700", +"tests/library_checker_aizu_tests/trees/edge_cd_reroot_dp.test.cpp": "2026-07-06 22:30:55 -0700", +"tests/library_checker_aizu_tests/trees/hld_aizu1.test.cpp": "2026-07-06 22:44:57 -0700", +"tests/library_checker_aizu_tests/trees/hld_aizu2.test.cpp": "2026-07-06 22:44:57 -0700", +"tests/library_checker_aizu_tests/trees/hld_lib_checker_path.test.cpp": "2026-07-06 22:44:57 -0700", +"tests/library_checker_aizu_tests/trees/hld_lib_checker_subtree_edges.test.cpp": "2026-07-06 22:44:57 -0700", +"tests/library_checker_aizu_tests/trees/hld_lib_checker_subtree_nodes.test.cpp": "2026-07-06 22:44:57 -0700", +"tests/library_checker_aizu_tests/trees/kth_path_hagerup.test.cpp": "2026-07-06 22:44:57 -0700", +"tests/library_checker_aizu_tests/trees/kth_path_ladder.test.cpp": "2026-07-06 22:44:57 -0700", +"tests/library_checker_aizu_tests/trees/kth_path_linear.test.cpp": "2026-07-06 22:44:57 -0700", +"tests/library_checker_aizu_tests/trees/kth_path_tree_lift.test.cpp": "2026-07-06 22:44:57 -0700", +"tests/library_checker_aizu_tests/trees/lca_all_methods_aizu.test.cpp": "2026-07-06 22:44:57 -0700", +"tests/library_checker_aizu_tests/trees/lca_all_methods_lib_checker.test.cpp": "2026-07-06 22:44:57 -0700", +"tests/library_checker_aizu_tests/trees/shallowest_aizu_tree_height.test.cpp": "2026-07-06 22:30:55 -0700", +"tests/library_checker_aizu_tests/trees/shallowest_lib_checker_tree_path_composite.test.cpp": "2026-07-06 22:30:55 -0700", +"tests/library_checker_aizu_tests/trees/subtree_isomorphism.test.cpp": "2026-07-06 22:30:55 -0700" } \ No newline at end of file diff --git a/library/contest/tester.sh b/library/contest/tester.sh index dccaf6b0..aecdc182 100644 --- a/library/contest/tester.sh +++ b/library/contest/tester.sh @@ -1,9 +1,9 @@ # https://github.com/Errichto/youtube/blob/master/testing/s.sh # bash tester.sh a naive gen -g++ -std=c++20 -g -D_GLIBCXX_DEBUG -fsanitize=address,undefined $1.cpp -o $1.out -g++ -std=c++20 $2.cpp -o $2.out -g++ -std=c++20 $3.cpp -o $3.out +g++ -std=c++23 -g -D_GLIBCXX_DEBUG -fsanitize=address,undefined $1.cpp -o $1.out +g++ -std=c++23 $2.cpp -o $2.out +g++ -std=c++23 $3.cpp -o $3.out for((i = 1; ; ++i)) do diff --git a/library/convolution/min_plus_convolution_convex_and_arbitrary.hpp b/library/convolution/min_plus_convolution_convex_and_arbitrary.hpp index 496f8c39..e131652a 100644 --- a/library/convolution/min_plus_convolution_convex_and_arbitrary.hpp +++ b/library/convolution/min_plus_convolution_convex_and_arbitrary.hpp @@ -9,7 +9,7 @@ vi min_plus(const vi& convex, const vi& arbitrary) { int n = sz(convex); int m = sz(arbitrary); vi res(n + m - 1, INT_MAX); - auto dnc = [&](auto&& dnc, int res_le, int res_ri, + auto dnc = [&](this auto&& dnc, int res_le, int res_ri, int arb_le, int arb_ri) { if (res_le >= res_ri) return; int mid_res = (res_le + res_ri) / 2; @@ -22,10 +22,10 @@ vi min_plus(const vi& convex, const vi& arbitrary) { op_arb = i; } } - dnc(dnc, res_le, mid_res, arb_le, - min(arb_ri, op_arb + 1)); - dnc(dnc, mid_res + 1, res_ri, op_arb, arb_ri); + dnc(res_le, mid_res, arb_le, min(arb_ri, op_arb + 1)); + // NOLINTNEXTLINE(readability-suspicious-call-argument) + dnc(mid_res + 1, res_ri, op_arb, arb_ri); }; - dnc(dnc, 0, n + m - 1, 0, m); + dnc(0, n + m - 1, 0, m); return res; } diff --git a/library/graphs/bcc_callback.hpp b/library/graphs/bcc_callback.hpp index a9b9ec70..a9a26adb 100644 --- a/library/graphs/bcc_callback.hpp +++ b/library/graphs/bcc_callback.hpp @@ -44,11 +44,11 @@ void bcc(const auto& g, auto f) { int n = sz(g), q = 0, s = 0; vi t(n), st(n); - auto dfs = [&](auto&& dfs, int u) -> int { + auto dfs = [&](this auto&& dfs, int u) -> int { int l = t[u] = ++q; for (int v : g[u]) { int siz = s, lu = 0; - l = min(l, t[v] ?: (lu = dfs(dfs, st[s++] = v))); + l = min(l, t[v] ?: (lu = dfs(st[s++] = v))); if (lu >= t[u]) { st[s++] = u; f({siz + all(st) - n + s}); @@ -57,5 +57,5 @@ void bcc(const auto& g, auto f) { } return l; }; - rep(i, 0, n) if (!t[i]) dfs(dfs, i); + rep(i, 0, n) if (!t[i]) dfs(i); } diff --git a/library/graphs/euler_path.hpp b/library/graphs/euler_path.hpp index e0ab350f..cd423a2b 100644 --- a/library/graphs/euler_path.hpp +++ b/library/graphs/euler_path.hpp @@ -16,15 +16,15 @@ vector euler_path(auto& g, int m, int s) { vi vis(m); vector path; - auto dfs = [&](auto&& dfs, int u, int eu) -> void { + auto dfs = [&](this auto&& dfs, int u, int eu) -> void { while (!empty(g[u])) { auto [v, ev] = g[u].back(); g[u].pop_back(); - if (!vis[ev]) vis[ev] = 1, dfs(dfs, v, ev); + if (!vis[ev]) vis[ev] = 1, dfs(v, ev); } path.emplace_back(u, eu); }; - dfs(dfs, s, -1); + dfs(s, -1); ranges::reverse(path); return path; } diff --git a/library/graphs/scc.hpp b/library/graphs/scc.hpp index fc2673cf..c82a9d15 100644 --- a/library/graphs/scc.hpp +++ b/library/graphs/scc.hpp @@ -11,18 +11,17 @@ auto scc(const auto& g) { int n = sz(g), num_sccs = 0, q = 0, s = 0; vi scc_id(n, -1), tin(n), st(n); - auto dfs = [&](auto&& dfs, int u) -> int { + auto dfs = [&](this auto&& dfs, int u) -> int { int low = tin[u] = ++q; st[s++] = u; for (int v : g[u]) - if (scc_id[v] < 0) - low = min(low, tin[v] ?: dfs(dfs, v)); + if (scc_id[v] < 0) low = min(low, tin[v] ?: dfs(v)); if (tin[u] == low) { while (scc_id[u] < 0) scc_id[st[--s]] = num_sccs; num_sccs++; } return low; }; - rep(i, 0, n) if (!tin[i]) dfs(dfs, i); + rep(i, 0, n) if (!tin[i]) dfs(i); return pair{num_sccs, scc_id}; } diff --git a/library/graphs/strongly_connected_components/add_edges_strongly_connected.hpp b/library/graphs/strongly_connected_components/add_edges_strongly_connected.hpp index 01dc54b6..5df1016b 100644 --- a/library/graphs/strongly_connected_components/add_edges_strongly_connected.hpp +++ b/library/graphs/strongly_connected_components/add_edges_strongly_connected.hpp @@ -29,12 +29,12 @@ vector extra_edges(const auto& g, int num_sccs, zero_in[scc_id[v]] = 0; } vector vis(num_sccs); - auto dfs = [&](auto&& dfs, int u) { + auto dfs = [&](this auto&& dfs, int u) { if (empty(scc_g[u])) return u; for (int v : scc_g[u]) if (!vis[v]) { vis[v] = 1; - int zero_out = dfs(dfs, v); + int zero_out = dfs(v); if (zero_out != -1) return zero_out; } return -1; @@ -43,7 +43,7 @@ vector extra_edges(const auto& g, int num_sccs, vi in_unused; rep(i, 0, num_sccs) if (zero_in[i]) { vis[i] = 1; - int zero_out = dfs(dfs, i); + int zero_out = dfs(i); if (zero_out != -1) edges.emplace_back(zero_out, i); else in_unused.push_back(i); } diff --git a/library/graphs/strongly_connected_components/offline_incremental_scc.hpp b/library/graphs/strongly_connected_components/offline_incremental_scc.hpp index ae03effe..10a63390 100644 --- a/library/graphs/strongly_connected_components/offline_incremental_scc.hpp +++ b/library/graphs/strongly_connected_components/offline_incremental_scc.hpp @@ -16,7 +16,7 @@ vi offline_incremental_scc(vector> eds, vi ids(n, -1), joins(m, m), idx(m), vs(n), scc_id; iota(all(idx), 0); vector g; - auto dnc = [&](auto&& dnc, auto el, auto er, int tl, + auto dnc = [&](this auto&& dnc, auto el, auto er, int tl, int tr) { g.clear(); int mid = midpoint(tl, tr); @@ -42,11 +42,11 @@ vi offline_incremental_scc(vector> eds, auto& [u, v] = eds[*it]; u = scc_id[u], v = scc_id[v]; } - dnc(dnc, el, split, tl, mid); - dnc(dnc, split, er, mid, tr); + dnc(el, split, tl, mid); + dnc(split, er, mid, tr); }; // uses -1 as the lower bound to correctly handle // self-edges - dnc(dnc, all(idx), -1, m); + dnc(all(idx), -1, m); return joins; } diff --git a/library/graphs/uncommon/bridges.hpp b/library/graphs/uncommon/bridges.hpp index 01d5f786..90198fa3 100644 --- a/library/graphs/uncommon/bridges.hpp +++ b/library/graphs/uncommon/bridges.hpp @@ -18,12 +18,12 @@ auto bridges(const auto& g, int m) { int n = sz(g), num_ccs = 0, q = 0, s = 0; vi br_id(n, -1), is_br(m), tin(n), st(n); - auto dfs = [&](auto&& dfs, int u, int p) -> int { + auto dfs = [&](this auto&& dfs, int u, int p) -> int { int low = tin[u] = ++q; st[s++] = u; for (auto [v, e] : g[u]) if (e != p && br_id[v] < 0) - low = min(low, tin[v] ?: dfs(dfs, v, e)); + low = min(low, tin[v] ?: dfs(v, e)); if (tin[u] == low) { if (p != -1) is_br[p] = 1; while (br_id[u] < 0) br_id[st[--s]] = num_ccs; @@ -31,6 +31,6 @@ auto bridges(const auto& g, int m) { } return low; }; - rep(i, 0, n) if (!tin[i]) dfs(dfs, i, -1); + rep(i, 0, n) if (!tin[i]) dfs(i, -1); return tuple{num_ccs, br_id, is_br}; } diff --git a/library/graphs/uncommon/cuts.hpp b/library/graphs/uncommon/cuts.hpp index 8986ae2b..cbf47c94 100644 --- a/library/graphs/uncommon/cuts.hpp +++ b/library/graphs/uncommon/cuts.hpp @@ -19,14 +19,14 @@ auto cuts(const auto& g, int m) { int n = sz(g), num_bccs = 0, q = 0, s = 0; vi bcc_id(m, -1), is_cut(n), tin(n), st(m); - auto dfs = [&](auto&& dfs, int u, int p) -> int { + auto dfs = [&](this auto&& dfs, int u, int p) -> int { int low = tin[u] = ++q; for (auto [v, e] : g[u]) { assert(u != v); if (e == p) continue; if (tin[v] < tin[u]) st[s++] = e; int lu = -1; - low = min(low, tin[v] ?: (lu = dfs(dfs, v, e))); + low = min(low, tin[v] ?: (lu = dfs(v, e))); if (lu >= tin[u]) { is_cut[u] = p >= 0 || tin[u] + 1 < tin[v]; while (bcc_id[e] < 0) bcc_id[st[--s]] = num_bccs; @@ -35,6 +35,6 @@ auto cuts(const auto& g, int m) { } return low; }; - rep(i, 0, n) if (!tin[i]) dfs(dfs, i, -1); + rep(i, 0, n) if (!tin[i]) dfs(i, -1); return tuple{num_bccs, bcc_id, is_cut}; } diff --git a/library/trees/centroid_decomp.hpp b/library/trees/centroid_decomp.hpp index 8918fe40..5d224205 100644 --- a/library/trees/centroid_decomp.hpp +++ b/library/trees/centroid_decomp.hpp @@ -8,19 +8,20 @@ //! @space O(n) vi cd(auto& g, auto f) { vi p(sz(g), -1), s(sz(g), sz(g)); - auto ctd = [&](auto&& ctd, int u, int p, int n) -> int { + auto ctd = [&](this auto&& ctd, int u, int p, + int n) -> int { s[u] = 1; for (int v : g[u]) if (v != p) { - if (int c = ctd(ctd, v, u, n); c != -1) return c; + if (int c = ctd(v, u, n); c != -1) return c; s[u] += s[v]; } return 2 * s[u] >= n ? s[p] = n - s[u], u : -1; }; - auto dfs = [&](auto&& dfs, int u) -> int { - f(u = ctd(ctd, u, u, s[u])); - for (int v : g[u]) erase(g[v], u), p[dfs(dfs, v)] = u; + auto dfs = [&](this auto&& dfs, int u) -> int { + f(u = ctd(u, u, s[u])); + for (int v : g[u]) erase(g[v], u), p[dfs(v)] = u; return u; }; - return dfs(dfs, 0), p; + return dfs(0), p; } diff --git a/library/trees/edge_cd.hpp b/library/trees/edge_cd.hpp index b7ed52c8..e7bf63b9 100644 --- a/library/trees/edge_cd.hpp +++ b/library/trees/edge_cd.hpp @@ -15,18 +15,19 @@ //! @space O(n) template void edge_cd(vector& g, auto f) { vi s(sz(g)); - auto ctd = [&](auto&& ctd, int u, int p, int m) -> int { + auto ctd = [&](this auto&& ctd, int u, int p, + int m) -> int { s[u] = 1; for (int v : g[u]) if (v != p) { - if (int c = ctd(ctd, v, u, m); c != -1) return c; + if (int c = ctd(v, u, m); c != -1) return c; s[u] += s[v]; } return 2 * s[u] > m ? s[p] = m + 1 - s[u], u : -1; }; - auto dfs = [&](auto&& dfs, int u, int m) { + auto dfs = [&](this auto&& dfs, int u, int m) { if (m < 2) return; - u = ctd(ctd, u, u, m); + u = ctd(u, u, m); int sum = 0; auto it = partition(all(g[u]), [&](int v) { ll x = sum + s[v]; @@ -35,9 +36,9 @@ template void edge_cd(vector& g, auto f) { f(u, it - begin(g[u])); G oth(it, end(g[u])); g[u].erase(it, end(g[u])); - dfs(dfs, u, sum); + dfs(u, sum); swap(g[u], oth); - dfs(dfs, u, m - sum); + dfs(u, m - sum); }; - dfs(dfs, 0, sz(g) - 1); + dfs(0, sz(g) - 1); }; diff --git a/library/trees/shallowest_decomp_tree.hpp b/library/trees/shallowest_decomp_tree.hpp index bb35d2c0..0c59111e 100644 --- a/library/trees/shallowest_decomp_tree.hpp +++ b/library/trees/shallowest_decomp_tree.hpp @@ -9,18 +9,18 @@ //! @space O(n) void shallowest(auto& g, auto f) { vector order(bit_width(size(g))); - auto dfs = [&](auto&& dfs, int u, int p) -> int { + auto dfs = [&](this auto&& dfs, int u, int p) -> int { int once = 0, twice = 0; for (int v : g[u]) if (v != p) { - int dp = dfs(dfs, v, u); + int dp = dfs(v, u); twice |= once & dp, once |= dp; } auto dp = (once | (bit_ceil(twice + 1u) - 1)) + 1; order[countr_zero(dp)].push_back(u); return dp; }; - dfs(dfs, 0, 0); + dfs(0, 0); for (const vi& vec : order | views::reverse) for (int u : vec) { f(u); diff --git a/library/trees/uncommon/subtree_isomorphism.hpp b/library/trees/uncommon/subtree_isomorphism.hpp index 708941d8..ffdecba3 100644 --- a/library/trees/uncommon/subtree_isomorphism.hpp +++ b/library/trees/uncommon/subtree_isomorphism.hpp @@ -12,15 +12,15 @@ auto subtree_iso(const auto& g) { vi iso_id(sz(g), -1); map hashes; - auto dfs = [&](auto&& dfs, int u, int p) -> int { + auto dfs = [&](this auto&& dfs, int u, int p) -> int { vi ch_ids; for (int v : g[u]) - if (v != p) ch_ids.push_back(dfs(dfs, v, u)); + if (v != p) ch_ids.push_back(dfs(v, u)); ranges::sort(ch_ids); return iso_id[u] = hashes.try_emplace(ch_ids, sz(hashes)) .first->second; }; - dfs(dfs, 0, 0); + dfs(0, 0); return pair{sz(hashes), iso_id}; } diff --git a/tests/scripts/update_main.sh b/tests/scripts/update_main.sh index f69b1ecc..39ae009e 100755 --- a/tests/scripts/update_main.sh +++ b/tests/scripts/update_main.sh @@ -12,7 +12,7 @@ git submodule update echo "DON'T PUSH ANY OF THESE CHANGES TO THE REPO!!!!!!!!" # remove NOLINTNEXTLINE comments -sed --in-place '/^\/\/ NOLINTNEXTLINE(readability-identifier-naming)$/d' ../library/**/*.hpp +sed --in-place '/^ *\/\/ NOLINTNEXTLINE(.*)$/d' ../library/**/*.hpp # to copy files like template.cpp, *.sh, *.png, *.md to root directory; so they exist in main branch # also to create all directories (cpp command below fails if destination path isn't created)