diff --git a/.verify-helper/timestamps.remote.json b/.verify-helper/timestamps.remote.json index 0d1b6b3b..3f4c2375 100644 --- a/.verify-helper/timestamps.remote.json +++ b/.verify-helper/timestamps.remote.json @@ -3,59 +3,6 @@ "tests/library_checker_aizu_tests/convolution/lcm_convolution.test.cpp": "2025-08-28 13:19:16 -0600", "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": "2025-08-06 18:45:47 -0600", -"tests/library_checker_aizu_tests/data_structures/bit.test.cpp": "2026-01-17 12:18:24 -0700", -"tests/library_checker_aizu_tests/data_structures/bit_inc.test.cpp": "2026-01-17 12:24:18 -0700", -"tests/library_checker_aizu_tests/data_structures/bit_ordered_set.test.cpp": "2026-01-17 13:35:19 -0700", -"tests/library_checker_aizu_tests/data_structures/bit_rupq.test.cpp": "2026-01-17 12:18:24 -0700", -"tests/library_checker_aizu_tests/data_structures/bit_rurq.test.cpp": "2026-01-17 12:18:24 -0700", -"tests/library_checker_aizu_tests/data_structures/bit_walk.test.cpp": "2026-01-17 12:18:24 -0700", -"tests/library_checker_aizu_tests/data_structures/deque.test.cpp": "2025-08-06 18:57:15 -0600", -"tests/library_checker_aizu_tests/data_structures/deque_index.test.cpp": "2025-08-22 11:48:31 -0600", -"tests/library_checker_aizu_tests/data_structures/deque_op.test.cpp": "2025-08-06 18:57:15 -0600", -"tests/library_checker_aizu_tests/data_structures/deque_sliding_window.test.cpp": "2025-08-06 18:57:15 -0600", -"tests/library_checker_aizu_tests/data_structures/disjoint_rmq_inc.test.cpp": "2024-12-14 15:47:13 -0600", -"tests/library_checker_aizu_tests/data_structures/disjoint_rmq_inc_lines.test.cpp": "2024-12-14 15:47:13 -0600", -"tests/library_checker_aizu_tests/data_structures/disjoint_rmq_lines.test.cpp": "2024-12-14 15:47:13 -0600", -"tests/library_checker_aizu_tests/data_structures/disjoint_rmq_sum.test.cpp": "2024-12-14 15:47:13 -0600", -"tests/library_checker_aizu_tests/data_structures/distinct_query.test.cpp": "2024-12-05 10:41:42 -0600", -"tests/library_checker_aizu_tests/data_structures/dsu.test.cpp": "2026-01-17 19:36:09 +0000", -"tests/library_checker_aizu_tests/data_structures/dsu_bipartite.test.cpp": "2025-08-05 15:52:46 -0600", -"tests/library_checker_aizu_tests/data_structures/dsu_restorable.test.cpp": "2024-11-17 14:04:03 -0600", -"tests/library_checker_aizu_tests/data_structures/dsu_segtree_undo_trick.test.cpp": "2024-12-14 19:50:29 -0600", -"tests/library_checker_aizu_tests/data_structures/implicit_seg_tree.test.cpp": "2025-08-28 13:51:20 -0600", -"tests/library_checker_aizu_tests/data_structures/kruskal_tree_aizu.test.cpp": "2025-08-05 13:14:30 -0600", -"tests/library_checker_aizu_tests/data_structures/kth_smallest_pst.test.cpp": "2024-12-05 10:41:42 -0600", -"tests/library_checker_aizu_tests/data_structures/kth_smallest_wavelet_matrix.test.cpp": "2025-07-10 12:34:21 -0600", -"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree.test.cpp": "2024-12-14 19:50:29 -0600", -"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_constructor.test.cpp": "2024-12-14 19:50:29 -0600", -"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_inc.test.cpp": "2024-12-05 10:41:42 -0600", -"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_inc_constructor.test.cpp": "2024-12-05 10:41:42 -0600", -"tests/library_checker_aizu_tests/data_structures/line_tree_aizu.test.cpp": "2025-02-10 14:50:36 -0700", -"tests/library_checker_aizu_tests/data_structures/line_tree_lib_checker.test.cpp": "2025-08-05 13:14:30 -0600", -"tests/library_checker_aizu_tests/data_structures/merge_sort_tree.test.cpp": "2025-08-04 17:01:28 -0600", -"tests/library_checker_aizu_tests/data_structures/mode_query.test.cpp": "2025-08-04 17:01:28 -0600", -"tests/library_checker_aizu_tests/data_structures/permutation_tree.test.cpp": "2025-08-14 12:01:15 -0600", -"tests/library_checker_aizu_tests/data_structures/persistent_queue_tree.test.cpp": "2025-02-10 14:50:36 -0700", -"tests/library_checker_aizu_tests/data_structures/persistent_seg_tree.test.cpp": "2024-12-05 10:41:42 -0600", -"tests/library_checker_aizu_tests/data_structures/pq_ds_undo_sliding_window.test.cpp": "2025-02-10 14:50:36 -0700", -"tests/library_checker_aizu_tests/data_structures/pq_ds_undo_with_dsu.test.cpp": "2025-02-10 14:50:36 -0700", -"tests/library_checker_aizu_tests/data_structures/range_parallel_dsu.test.cpp": "2025-09-07 15:50:55 -0600", -"tests/library_checker_aizu_tests/data_structures/rmq_disjoint_sparse_table.test.cpp": "2024-12-15 14:34:10 -0600", -"tests/library_checker_aizu_tests/data_structures/rmq_linear.test.cpp": "2025-08-14 12:01:15 -0600", -"tests/library_checker_aizu_tests/data_structures/rmq_sparse_table.test.cpp": "2025-08-14 12:01:15 -0600", -"tests/library_checker_aizu_tests/data_structures/rmq_sparse_table_inc.test.cpp": "2024-12-15 14:34:10 -0600", -"tests/library_checker_aizu_tests/data_structures/simple_tree.test.cpp": "2024-12-14 15:47:13 -0600", -"tests/library_checker_aizu_tests/data_structures/simple_tree_inc.test.cpp": "2024-12-21 00:23:10 -0500", -"tests/library_checker_aizu_tests/data_structures/simple_tree_inc_line.test.cpp": "2024-12-21 00:23:10 -0500", -"tests/library_checker_aizu_tests/data_structures/simple_tree_line.test.cpp": "2024-12-14 15:47:13 -0600", -"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", -"tests/library_checker_aizu_tests/flow/min_cost_max_flow.test.cpp": "2024-12-05 10:41:42 -0600", -"tests/library_checker_aizu_tests/graphs/bcc_callback_aizu_bcc.test.cpp": "2026-01-17 13:05:42 -0700", -"tests/library_checker_aizu_tests/graphs/bcc_callback_aizu_two_edge_cc.test.cpp": "2026-01-17 13:05:42 -0700", -"tests/library_checker_aizu_tests/graphs/bcc_callback_lib_checker_bcc.test.cpp": "2026-01-17 13:05:42 -0700", -"tests/library_checker_aizu_tests/graphs/bcc_callback_lib_checker_two_cc.test.cpp": "2026-01-17 13:05:42 -0700", "tests/library_checker_aizu_tests/graphs/biconnected_components.test.cpp": "2025-12-11 21:47:53 +0000", "tests/library_checker_aizu_tests/graphs/connected_components_of_complement_graph.test.cpp": "2025-08-14 10:27:46 -0600", "tests/library_checker_aizu_tests/graphs/dijkstra_aizu.test.cpp": "2025-08-14 10:27:46 -0600", @@ -64,28 +11,20 @@ "tests/library_checker_aizu_tests/graphs/enumerate_triangles.test.cpp": "2025-08-06 16:18:37 -0600", "tests/library_checker_aizu_tests/graphs/hopcroft_karp_aizu.test.cpp": "2025-12-11 21:47:53 +0000", "tests/library_checker_aizu_tests/graphs/hopcroft_karp_lib_checker.test.cpp": "2025-12-11 21:47:53 +0000", -"tests/library_checker_aizu_tests/graphs/mst.test.cpp": "2026-01-17 12:26:02 -0700", -"tests/library_checker_aizu_tests/graphs/offline_incremental_scc.test.cpp": "2026-01-17 13:05:42 -0700", -"tests/library_checker_aizu_tests/graphs/strongly_connected_components_aizu.test.cpp": "2026-01-17 13:05:42 -0700", -"tests/library_checker_aizu_tests/graphs/strongly_connected_components_lib_checker.test.cpp": "2026-01-17 13:05:42 -0700", -"tests/library_checker_aizu_tests/graphs/two_edge_components.test.cpp": "2025-12-11 21:47:53 +0000", -"tests/library_checker_aizu_tests/handmade_tests/count_paths.test.cpp": "2025-12-11 21:47:53 +0000", -"tests/library_checker_aizu_tests/handmade_tests/dsu.test.cpp": "2026-01-17 12:26:02 -0700", -"tests/library_checker_aizu_tests/handmade_tests/dsu_size.test.cpp": "2024-12-14 19:50:29 -0600", "tests/library_checker_aizu_tests/handmade_tests/edge_cd_small_trees.test.cpp": "2025-09-07 15:50:55 -0600", "tests/library_checker_aizu_tests/handmade_tests/fib_matrix_expo.test.cpp": "2025-08-28 13:19:16 -0600", "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-07 15:54:16 -0600", -"tests/library_checker_aizu_tests/handmade_tests/manacher.test.cpp": "2024-12-14 19:50:29 -0600", -"tests/library_checker_aizu_tests/handmade_tests/merge_st_and_wavelet.test.cpp": "2025-08-04 17:01:28 -0600", +"tests/library_checker_aizu_tests/handmade_tests/hilbert_mos.test.cpp": "2026-01-17 15:07:54 -0700", +"tests/library_checker_aizu_tests/handmade_tests/manacher.test.cpp": "2026-01-17 15:07:54 -0700", +"tests/library_checker_aizu_tests/handmade_tests/merge_st_and_wavelet.test.cpp": "2026-01-17 15:07:54 -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": "2025-08-14 12:01:15 -0600", -"tests/library_checker_aizu_tests/handmade_tests/rmq_small_n.test.cpp": "2025-08-14 12:01:15 -0600", -"tests/library_checker_aizu_tests/handmade_tests/sa_find_subarray.test.cpp": "2025-02-10 14:50:36 -0700", -"tests/library_checker_aizu_tests/handmade_tests/seg_tree_find.test.cpp": "2026-01-17 12:18:24 -0700", -"tests/library_checker_aizu_tests/handmade_tests/seg_tree_find_small.test.cpp": "2024-12-14 19:50:29 -0600", +"tests/library_checker_aizu_tests/handmade_tests/permutation_tree_small.test.cpp": "2026-01-17 15:14:21 -0700", +"tests/library_checker_aizu_tests/handmade_tests/rmq_small_n.test.cpp": "2026-01-17 15:07:54 -0700", +"tests/library_checker_aizu_tests/handmade_tests/sa_find_subarray.test.cpp": "2026-01-17 14:47:10 -0700", +"tests/library_checker_aizu_tests/handmade_tests/seg_tree_find.test.cpp": "2026-01-17 18:13:38 -0700", +"tests/library_checker_aizu_tests/handmade_tests/seg_tree_find_small.test.cpp": "2026-01-17 15:12:43 -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", @@ -105,41 +44,41 @@ "tests/library_checker_aizu_tests/math/xor_basis.test.cpp": "2025-08-04 20:35:27 -0600", "tests/library_checker_aizu_tests/math/xor_basis_intersection.test.cpp": "2025-08-04 20:35:27 -0600", "tests/library_checker_aizu_tests/monotonic_stack_related/cartesian_binary_tree.test.cpp": "2025-02-10 14:50:36 -0700", -"tests/library_checker_aizu_tests/monotonic_stack_related/cartesian_k_ary_tree.test.cpp": "2025-08-14 12:01:15 -0600", -"tests/library_checker_aizu_tests/monotonic_stack_related/count_rectangles.test.cpp": "2025-08-14 12:01:15 -0600", -"tests/library_checker_aizu_tests/monotonic_stack_related/max_rect_histogram.test.cpp": "2025-08-14 12:01:15 -0600", +"tests/library_checker_aizu_tests/monotonic_stack_related/cartesian_k_ary_tree.test.cpp": "2026-01-17 14:47:10 -0700", +"tests/library_checker_aizu_tests/monotonic_stack_related/count_rectangles.test.cpp": "2026-01-17 14:47:10 -0700", +"tests/library_checker_aizu_tests/monotonic_stack_related/max_rect_histogram.test.cpp": "2026-01-17 14:47:10 -0700", "tests/library_checker_aizu_tests/strings/kmp.test.cpp": "2025-08-05 19:19:23 -0600", "tests/library_checker_aizu_tests/strings/lcp_array.test.cpp": "2025-08-05 19:19:23 -0600", -"tests/library_checker_aizu_tests/strings/lcp_query_palindrome.test.cpp": "2025-08-05 19:19:23 -0600", -"tests/library_checker_aizu_tests/strings/lcp_query_zfunc.test.cpp": "2025-08-05 19:19:23 -0600", +"tests/library_checker_aizu_tests/strings/lcp_query_palindrome.test.cpp": "2026-01-17 14:47:10 -0700", +"tests/library_checker_aizu_tests/strings/lcp_query_zfunc.test.cpp": "2026-01-17 14:47:10 -0700", "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-17 12:18:24 -0700", -"tests/library_checker_aizu_tests/strings/lcs_queries_merge_sort_tree.test.cpp": "2025-08-05 19:19:23 -0600", +"tests/library_checker_aizu_tests/strings/lcs_queries.test.cpp": "2026-01-17 18:13:38 -0700", +"tests/library_checker_aizu_tests/strings/lcs_queries_merge_sort_tree.test.cpp": "2026-01-17 14:47:10 -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": "2025-08-05 19:19:23 -0600", +"tests/library_checker_aizu_tests/strings/multi_matching_bs.test.cpp": "2026-01-17 14:47:10 -0700", "tests/library_checker_aizu_tests/strings/prefix_function.test.cpp": "2025-08-05 19:19:23 -0600", -"tests/library_checker_aizu_tests/strings/sa_cmp.test.cpp": "2025-02-10 14:50:36 -0700", -"tests/library_checker_aizu_tests/strings/sa_sort_pairs.test.cpp": "2025-02-10 14:50:36 -0700", -"tests/library_checker_aizu_tests/strings/single_matching_bs.test.cpp": "2025-08-05 19:19:23 -0600", -"tests/library_checker_aizu_tests/strings/suffix_array.test.cpp": "2025-08-14 12:01:15 -0600", +"tests/library_checker_aizu_tests/strings/sa_cmp.test.cpp": "2026-01-17 14:47:10 -0700", +"tests/library_checker_aizu_tests/strings/sa_sort_pairs.test.cpp": "2026-01-17 14:47:10 -0700", +"tests/library_checker_aizu_tests/strings/single_matching_bs.test.cpp": "2026-01-17 14:47:10 -0700", +"tests/library_checker_aizu_tests/strings/suffix_array.test.cpp": "2026-01-17 14:47:10 -0700", "tests/library_checker_aizu_tests/strings/suffix_array_short.test.cpp": "2025-08-05 19:19:23 -0600", "tests/library_checker_aizu_tests/strings/trie.test.cpp": "2026-01-17 12:38:18 -0700", "tests/library_checker_aizu_tests/strings/wildcard_pattern_matching.test.cpp": "2025-08-05 19:19:23 -0600", "tests/library_checker_aizu_tests/trees/count_paths_per_length.test.cpp": "2025-12-11 21:47:53 +0000", -"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_query.test.cpp": "2026-01-17 12:18:24 -0700", -"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_update.test.cpp": "2026-01-17 12:18:24 -0700", +"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_query.test.cpp": "2026-01-17 18:13:38 -0700", +"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_update.test.cpp": "2026-01-17 18:13:38 -0700", "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-17 12:18:24 -0700", -"tests/library_checker_aizu_tests/trees/hld_aizu2.test.cpp": "2025-12-11 21:47:53 +0000", -"tests/library_checker_aizu_tests/trees/hld_lib_checker_path.test.cpp": "2026-01-17 12:18:24 -0700", -"tests/library_checker_aizu_tests/trees/hld_lib_checker_subtree_edges.test.cpp": "2026-01-17 12:18:24 -0700", -"tests/library_checker_aizu_tests/trees/hld_lib_checker_subtree_nodes.test.cpp": "2026-01-17 12:18:24 -0700", +"tests/library_checker_aizu_tests/trees/hld_aizu1.test.cpp": "2026-01-17 18:13:38 -0700", +"tests/library_checker_aizu_tests/trees/hld_aizu2.test.cpp": "2026-01-17 15:07:54 -0700", +"tests/library_checker_aizu_tests/trees/hld_lib_checker_path.test.cpp": "2026-01-17 18:13:38 -0700", +"tests/library_checker_aizu_tests/trees/hld_lib_checker_subtree_edges.test.cpp": "2026-01-17 18:13:38 -0700", +"tests/library_checker_aizu_tests/trees/hld_lib_checker_subtree_nodes.test.cpp": "2026-01-17 18:13:38 -0700", "tests/library_checker_aizu_tests/trees/kth_path_ladder.test.cpp": "2025-12-11 21:47:53 +0000", -"tests/library_checker_aizu_tests/trees/kth_path_linear.test.cpp": "2025-12-11 21:47:53 +0000", -"tests/library_checker_aizu_tests/trees/kth_path_tree_lift.test.cpp": "2025-12-11 21:47:53 +0000", -"tests/library_checker_aizu_tests/trees/lca_all_methods_aizu.test.cpp": "2025-12-11 21:47:53 +0000", -"tests/library_checker_aizu_tests/trees/lca_all_methods_lib_checker.test.cpp": "2025-12-11 21:47:53 +0000", +"tests/library_checker_aizu_tests/trees/kth_path_linear.test.cpp": "2026-01-17 15:07:54 -0700", +"tests/library_checker_aizu_tests/trees/kth_path_tree_lift.test.cpp": "2026-01-17 15:07:54 -0700", +"tests/library_checker_aizu_tests/trees/lca_all_methods_aizu.test.cpp": "2026-01-17 15:07:54 -0700", +"tests/library_checker_aizu_tests/trees/lca_all_methods_lib_checker.test.cpp": "2026-01-17 15:07:54 -0700", "tests/library_checker_aizu_tests/trees/shallowest_aizu_tree_height.test.cpp": "2025-12-11 21:47:53 +0000", "tests/library_checker_aizu_tests/trees/shallowest_lib_checker_tree_path_composite.test.cpp": "2025-12-11 21:47:53 +0000", "tests/library_checker_aizu_tests/trees/subtree_isomorphism.test.cpp": "2025-12-11 21:47:53 +0000" diff --git a/library/data_structures/README.md b/library/data_structures/README.md deleted file mode 100644 index 5d3b14dc..00000000 --- a/library/data_structures/README.md +++ /dev/null @@ -1,7 +0,0 @@ -seg tree indexing with n=19 - -![](lazy_seg_tree.png) - -If you use [Efficient and easy segment trees](https://codeforces.com/blog/entry/18051) then the indexing looks like this - -![](seg_tree.png) diff --git a/library/data_structures/uncommon/disjoint_rmq_inc.hpp b/library/data_structures/uncommon/disjoint_rmq_inc.hpp deleted file mode 100644 index 25dd533f..00000000 --- a/library/data_structures/uncommon/disjoint_rmq_inc.hpp +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once -//! https://codeforces.com/blog/entry/87940 -//! Disjoint RMQ is like normal RMQ except -//! the 2 query ranges never overlap. -//! @code -//! disjoint_rmq rmq(a, [&](int x, int y) { -//! return 1LL*x*y%10; -//! }); -//! @endcode -//! @time O(nlogn + q) -//! @space O(nlogn) -template struct disjoint_rmq_inc { - vector> dp; - F op; - disjoint_rmq_inc(const vector& a, F op): op(op) { - for (int len = 1, n = sz(a); len <= n; len *= 2) { - dp.emplace_back(n); - for (int l = 0; l < n; l += 2 * len) { - int mi = min(n, l + len), r = min(n, l + 2 * len); - partial_sum(rend(a) - mi, rend(a) - l, - rend(dp.back()) - mi, - [&](T x, T y) { return op(y, x); }); - partial_sum(begin(a) + mi, begin(a) + r, - begin(dp.back()) + mi, op); - } - } - } - T query(int l, int r) { // [l, r] - if (l == r) return dp[0][l]; - int lg = __lg(l ^ r); - return op(dp[lg][l], dp[lg][r]); - } -}; diff --git a/library/data_structures/bit.hpp b/library/data_structures_[l,r)/bit.hpp similarity index 90% rename from library/data_structures/bit.hpp rename to library/data_structures_[l,r)/bit.hpp index 4a2ed094..5e657eb7 100644 --- a/library/data_structures/bit.hpp +++ b/library/data_structures_[l,r)/bit.hpp @@ -5,7 +5,7 @@ struct BIT { vector s; BIT(int n): s(n) {} -#include "bit_uncommon/vector_constructor.hpp" +#include "bit_uncommon/init.hpp" void update(int i, ll d) { for (; i < sz(s); i |= i + 1) s[i] += d; } diff --git a/library/data_structures/bit_uncommon/vector_constructor.hpp b/library/data_structures_[l,r)/bit_uncommon/init.hpp similarity index 100% rename from library/data_structures/bit_uncommon/vector_constructor.hpp rename to library/data_structures_[l,r)/bit_uncommon/init.hpp diff --git a/library/data_structures/bit_uncommon/rupq.hpp b/library/data_structures_[l,r)/bit_uncommon/rupq.hpp similarity index 100% rename from library/data_structures/bit_uncommon/rupq.hpp rename to library/data_structures_[l,r)/bit_uncommon/rupq.hpp diff --git a/library/data_structures/bit_uncommon/rurq.hpp b/library/data_structures_[l,r)/bit_uncommon/rurq.hpp similarity index 100% rename from library/data_structures/bit_uncommon/rurq.hpp rename to library/data_structures_[l,r)/bit_uncommon/rurq.hpp diff --git a/library/data_structures/bit_uncommon/walk.hpp b/library/data_structures_[l,r)/bit_uncommon/walk.hpp similarity index 100% rename from library/data_structures/bit_uncommon/walk.hpp rename to library/data_structures_[l,r)/bit_uncommon/walk.hpp diff --git a/library/data_structures/lazy_seg_tree.hpp b/library/data_structures_[l,r)/lazy_seg_tree.hpp similarity index 97% rename from library/data_structures/lazy_seg_tree.hpp rename to library/data_structures_[l,r)/lazy_seg_tree.hpp index 817ecaa9..383a8d08 100644 --- a/library/data_structures/lazy_seg_tree.hpp +++ b/library/data_structures_[l,r)/lazy_seg_tree.hpp @@ -1,5 +1,5 @@ #pragma once -#include "lazy_seg_tree_midpoint.hpp" +#include "seg_tree_midpoint.hpp" ll op(ll vl, ll vr) { return vl + vr; } struct seg_tree { int n; diff --git a/library/data_structures/rmq.hpp b/library/data_structures_[l,r)/rmq.hpp similarity index 100% rename from library/data_structures/rmq.hpp rename to library/data_structures_[l,r)/rmq.hpp diff --git a/library/data_structures/seg_tree.hpp b/library/data_structures_[l,r)/seg_tree.hpp similarity index 100% rename from library/data_structures/seg_tree.hpp rename to library/data_structures_[l,r)/seg_tree.hpp diff --git a/library/data_structures/lazy_seg_tree_midpoint.hpp b/library/data_structures_[l,r)/seg_tree_midpoint.hpp similarity index 100% rename from library/data_structures/lazy_seg_tree_midpoint.hpp rename to library/data_structures_[l,r)/seg_tree_midpoint.hpp diff --git a/library/data_structures/seg_tree_uncommon/distinct_query.hpp b/library/data_structures_[l,r)/seg_tree_uncommon/distinct_query.hpp similarity index 100% rename from library/data_structures/seg_tree_uncommon/distinct_query.hpp rename to library/data_structures_[l,r)/seg_tree_uncommon/distinct_query.hpp diff --git a/library/data_structures/seg_tree_uncommon/find_first.hpp b/library/data_structures_[l,r)/seg_tree_uncommon/find_first.hpp similarity index 100% rename from library/data_structures/seg_tree_uncommon/find_first.hpp rename to library/data_structures_[l,r)/seg_tree_uncommon/find_first.hpp diff --git a/library/data_structures/seg_tree_uncommon/find_last.hpp b/library/data_structures_[l,r)/seg_tree_uncommon/find_last.hpp similarity index 100% rename from library/data_structures/seg_tree_uncommon/find_last.hpp rename to library/data_structures_[l,r)/seg_tree_uncommon/find_last.hpp diff --git a/library/data_structures/seg_tree_uncommon/implicit.hpp b/library/data_structures_[l,r)/seg_tree_uncommon/implicit.hpp similarity index 100% rename from library/data_structures/seg_tree_uncommon/implicit.hpp rename to library/data_structures_[l,r)/seg_tree_uncommon/implicit.hpp diff --git a/library/data_structures/seg_tree_uncommon/kth_smallest_query.hpp b/library/data_structures_[l,r)/seg_tree_uncommon/kth_smallest_query.hpp similarity index 100% rename from library/data_structures/seg_tree_uncommon/kth_smallest_query.hpp rename to library/data_structures_[l,r)/seg_tree_uncommon/kth_smallest_query.hpp diff --git a/library/data_structures/seg_tree_uncommon/merge_sort_tree.hpp b/library/data_structures_[l,r)/seg_tree_uncommon/merge_sort_tree.hpp similarity index 95% rename from library/data_structures/seg_tree_uncommon/merge_sort_tree.hpp rename to library/data_structures_[l,r)/seg_tree_uncommon/merge_sort_tree.hpp index 868f8466..54a44dd9 100644 --- a/library/data_structures/seg_tree_uncommon/merge_sort_tree.hpp +++ b/library/data_structures_[l,r)/seg_tree_uncommon/merge_sort_tree.hpp @@ -1,5 +1,5 @@ #pragma once -#include "../lazy_seg_tree_midpoint.hpp" +#include "../seg_tree_midpoint.hpp" struct merge_sort_tree { int n; vector tree; diff --git a/library/data_structures/seg_tree_uncommon/persistent.hpp b/library/data_structures_[l,r)/seg_tree_uncommon/persistent.hpp similarity index 100% rename from library/data_structures/seg_tree_uncommon/persistent.hpp rename to library/data_structures_[l,r)/seg_tree_uncommon/persistent.hpp diff --git a/library/data_structures/seg_tree_uncommon/wavelet_bit_vec.hpp b/library/data_structures_[l,r)/seg_tree_uncommon/wavelet_bit_vec.hpp similarity index 100% rename from library/data_structures/seg_tree_uncommon/wavelet_bit_vec.hpp rename to library/data_structures_[l,r)/seg_tree_uncommon/wavelet_bit_vec.hpp diff --git a/library/data_structures/seg_tree_uncommon/wavelet_count_less.hpp b/library/data_structures_[l,r)/seg_tree_uncommon/wavelet_count_less.hpp similarity index 100% rename from library/data_structures/seg_tree_uncommon/wavelet_count_less.hpp rename to library/data_structures_[l,r)/seg_tree_uncommon/wavelet_count_less.hpp diff --git a/library/data_structures/seg_tree_uncommon/wavelet_matrix.hpp b/library/data_structures_[l,r)/seg_tree_uncommon/wavelet_matrix.hpp similarity index 100% rename from library/data_structures/seg_tree_uncommon/wavelet_matrix.hpp rename to library/data_structures_[l,r)/seg_tree_uncommon/wavelet_matrix.hpp diff --git a/library/data_structures/uncommon/deque_op.hpp b/library/data_structures_[l,r)/uncommon/deque_op.hpp similarity index 100% rename from library/data_structures/uncommon/deque_op.hpp rename to library/data_structures_[l,r)/uncommon/deque_op.hpp diff --git a/library/data_structures/uncommon/hilbert_mos.hpp b/library/data_structures_[l,r)/uncommon/hilbert_mos.hpp similarity index 100% rename from library/data_structures/uncommon/hilbert_mos.hpp rename to library/data_structures_[l,r)/uncommon/hilbert_mos.hpp diff --git a/library/data_structures/lazy_seg_tree.png b/library/data_structures_[l,r)/uncommon/lazy_seg_tree.png similarity index 100% rename from library/data_structures/lazy_seg_tree.png rename to library/data_structures_[l,r)/uncommon/lazy_seg_tree.png diff --git a/library/data_structures/uncommon/mode_query.hpp b/library/data_structures_[l,r)/uncommon/mode_query.hpp similarity index 100% rename from library/data_structures/uncommon/mode_query.hpp rename to library/data_structures_[l,r)/uncommon/mode_query.hpp diff --git a/library/data_structures/uncommon/permutation_tree.hpp b/library/data_structures_[l,r)/uncommon/permutation_tree.hpp similarity index 97% rename from library/data_structures/uncommon/permutation_tree.hpp rename to library/data_structures_[l,r)/uncommon/permutation_tree.hpp index ee951b21..20e6a089 100644 --- a/library/data_structures/uncommon/permutation_tree.hpp +++ b/library/data_structures_[l,r)/uncommon/permutation_tree.hpp @@ -1,5 +1,5 @@ #pragma once -#include "linear_rmq.hpp" +#include "../../data_structures_[l,r]/linear_rmq.hpp" //! https://codeforces.com/blog/entry/78898 //! @code //! auto [p, root, ch] = perm_tree(a); diff --git a/library/data_structures/uncommon/priority_queue_of_updates.hpp b/library/data_structures_[l,r)/uncommon/priority_queue_of_updates.hpp similarity index 100% rename from library/data_structures/uncommon/priority_queue_of_updates.hpp rename to library/data_structures_[l,r)/uncommon/priority_queue_of_updates.hpp diff --git a/library/data_structures/seg_tree.png b/library/data_structures_[l,r)/uncommon/seg_tree.png similarity index 100% rename from library/data_structures/seg_tree.png rename to library/data_structures_[l,r)/uncommon/seg_tree.png diff --git a/library/data_structures/bit_inc.hpp b/library/data_structures_[l,r]/bit.hpp similarity index 63% rename from library/data_structures/bit_inc.hpp rename to library/data_structures_[l,r]/bit.hpp index 4c366b01..600bf89f 100644 --- a/library/data_structures/bit_inc.hpp +++ b/library/data_structures_[l,r]/bit.hpp @@ -1,9 +1,11 @@ #pragma once //! @time O(n + q log n) //! @space O(n) -struct bit_inc { +// NOLINTNEXTLINE(readability-identifier-naming) +struct BIT { vector s; - bit_inc(int n): s(n) {} + BIT(int n): s(n) {} +#include "../data_structures_[l,r)/bit_uncommon/init.hpp" void update(int i, ll d) { for (; i < sz(s); i |= i + 1) s[i] += d; } @@ -15,5 +17,5 @@ struct bit_inc { ll query(int l, int r) { // [l, r] return query(r) - query(l - 1); } -#include "bit_uncommon/walk.hpp" +#include "../data_structures_[l,r)/bit_uncommon/walk.hpp" }; diff --git a/library/data_structures/uncommon/disjoint_rmq.hpp b/library/data_structures_[l,r]/disjoint_rmq.hpp similarity index 83% rename from library/data_structures/uncommon/disjoint_rmq.hpp rename to library/data_structures_[l,r]/disjoint_rmq.hpp index d18eb0b4..c7886ca1 100644 --- a/library/data_structures/uncommon/disjoint_rmq.hpp +++ b/library/data_structures_[l,r]/disjoint_rmq.hpp @@ -25,10 +25,9 @@ template struct disjoint_rmq { } } } - T query(int l, int r) { // [l, r) - assert(l < r); - if (r - l == 1) return dp[0][l]; - int lg = __lg(l ^ (r - 1)); - return op(dp[lg][l], dp[lg][r - 1]); + T query(int l, int r) { // [l, r] + if (l == r) return dp[0][l]; + int lg = __lg(l ^ r); + return op(dp[lg][l], dp[lg][r]); } }; diff --git a/library/data_structures/lazy_seg_tree_inc.hpp b/library/data_structures_[l,r]/lazy_seg_tree.hpp similarity index 72% rename from library/data_structures/lazy_seg_tree_inc.hpp rename to library/data_structures_[l,r]/lazy_seg_tree.hpp index 098dace8..411e27b0 100644 --- a/library/data_structures/lazy_seg_tree_inc.hpp +++ b/library/data_structures_[l,r]/lazy_seg_tree.hpp @@ -1,16 +1,15 @@ #pragma once -#include "lazy_seg_tree_inc_midpoint.hpp" -ll op_inc(ll vl, ll vr) { return vl + vr; } -struct seg_tree_inc { +#include "seg_tree_midpoint.hpp" +ll op(ll vl, ll vr) { return vl + vr; } +struct seg_tree { int n; vector tree, lazy; - seg_tree_inc(int n): n(n), tree(2 * n), lazy(n) {} - seg_tree_inc(const vi& a): - n(sz(a)), tree(2 * n), lazy(n) { + seg_tree(int n): n(n), tree(2 * n), lazy(n) {} + seg_tree(const vi& a): n(sz(a)), tree(2 * n), lazy(n) { int pw2 = bit_ceil(size(a)); rep(i, 0, n) tree[(i + pw2) % n + n] = a[i]; for (int i = n - 1; i >= 1; i--) - tree[i] = op_inc(tree[2 * i], tree[2 * i + 1]); + tree[i] = op(tree[2 * i], tree[2 * i + 1]); } void apply(ll change, int tl, int tr, int v) { tree[v] += (tr - tl + 1) * change; @@ -31,11 +30,11 @@ struct seg_tree_inc { if (r < tl || tr < l) return; if (l <= tl && tr <= r) return apply(change, tl, tr, v); - int tm = split_inc(tl, tr); + 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); - tree[v] = op_inc(tree[2 * v], tree[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); @@ -43,9 +42,9 @@ struct seg_tree_inc { ll query_impl(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_inc(tl, tr); + int tm = split(tl, tr); push(tl, tm, tr, v); - return op_inc(query_impl(l, r, tl, tm, 2 * v), + return op(query_impl(l, r, tl, tm, 2 * v), query_impl(l, r, tm + 1, tr, 2 * v + 1)); } }; diff --git a/library/data_structures/uncommon/linear_rmq.hpp b/library/data_structures_[l,r]/linear_rmq.hpp similarity index 100% rename from library/data_structures/uncommon/linear_rmq.hpp rename to library/data_structures_[l,r]/linear_rmq.hpp diff --git a/library/data_structures/rmq_inc.hpp b/library/data_structures_[l,r]/rmq.hpp similarity index 67% rename from library/data_structures/rmq_inc.hpp rename to library/data_structures_[l,r]/rmq.hpp index 3b6f7351..79f22b83 100644 --- a/library/data_structures/rmq_inc.hpp +++ b/library/data_structures_[l,r]/rmq.hpp @@ -1,19 +1,20 @@ #pragma once //! @code -//! rmq_inc rmq1(a, ranges::min); -//! rmq_inc rmq2(a, [&](auto& x, auto& y) { +//! RMQ rmq1(a, ranges::min); +//! RMQ rmq2(a, [&](auto& x, auto& y) { //! return min(x, y); //! }); -//! vector>> +//! vector>> //! rmqs(3, {{}, NULL}); //! rmqs[1] = {a, ranges::min}; //! @endcode //! @time O(nlogn + q) //! @space O(nlogn) -template struct rmq_inc { +// NOLINTNEXTLINE(readability-identifier-naming) +template struct RMQ { vector> dp; F op; - rmq_inc(const vector& a, F op): dp(1, a), op(op) { + RMQ(const vector& a, F op): dp(1, a), op(op) { for (int i = 0; (2 << i) <= sz(a); i++) { dp.emplace_back(sz(a) - (2 << i) + 1); ranges::transform(dp[i], dp[i] | views::drop(1 << i), diff --git a/library/data_structures/seg_tree_inc.hpp b/library/data_structures_[l,r]/seg_tree.hpp similarity index 76% rename from library/data_structures/seg_tree_inc.hpp rename to library/data_structures_[l,r]/seg_tree.hpp index 2a06383d..fd9e4ca8 100644 --- a/library/data_structures/seg_tree_inc.hpp +++ b/library/data_structures_[l,r]/seg_tree.hpp @@ -2,11 +2,11 @@ //! https://codeforces.com/blog/entry/118682 //! @code //! { -//! tree_inc st(n, pii{}, [&](pii& l, pii& r) { +//! tree st(n, pii{}, [&](pii& l, pii& r) { //! return min(l, r); //! }); //! } -//! tree_inc st(n, int{}, ranges::min); +//! tree st(n, int{}, ranges::min); //! rep(i, 0, n) st.update(i, a[i]); //! @endcode //! @time O(n + q log n) @@ -15,11 +15,11 @@ int nxt(int& l, int r) { int lg = __lg(min(l & -l, r - l + 1)); return exchange(l, l + (1 << lg)) >> lg; } -template struct tree_inc { +template struct tree { int n; F op; vector s; - tree_inc(int n, T, F op): n(n), op(op), s(2 * n) {} + tree(int n, T, F op): n(n), op(op), s(2 * n) {} void update(int i, T val) { for (s[i += n] = val; i /= 2;) s[i] = op(s[2 * i], s[2 * i + 1]); diff --git a/library/data_structures/lazy_seg_tree_inc_midpoint.hpp b/library/data_structures_[l,r]/seg_tree_midpoint.hpp similarity index 76% rename from library/data_structures/lazy_seg_tree_inc_midpoint.hpp rename to library/data_structures_[l,r]/seg_tree_midpoint.hpp index e4af4900..e7d3e700 100644 --- a/library/data_structures/lazy_seg_tree_inc_midpoint.hpp +++ b/library/data_structures_[l,r]/seg_tree_midpoint.hpp @@ -1,10 +1,10 @@ #pragma once //! https://codeforces.com/blog/entry/112755 //! @code -//! int tm = split_inc(tl, tr); +//! int tm = split(tl, tr); //! // [tl,tr] splits into [tl,tm] and [tm+1,tr] //! @endcode -int split_inc(int tl, int tr) { +int split(int tl, int tr) { int pw2 = 1 << __lg(tr - tl + 1); return min(tl + pw2 - 1, tr - pw2 / 2); } diff --git a/library/data_structures/dsu/dsu.hpp b/library/dsu/dsu.hpp similarity index 100% rename from library/data_structures/dsu/dsu.hpp rename to library/dsu/dsu.hpp diff --git a/library/data_structures/dsu/dsu_bipartite.hpp b/library/dsu/dsu_bipartite.hpp similarity index 100% rename from library/data_structures/dsu/dsu_bipartite.hpp rename to library/dsu/dsu_bipartite.hpp diff --git a/library/data_structures/dsu/dsu_restorable.hpp b/library/dsu/dsu_restorable.hpp similarity index 100% rename from library/data_structures/dsu/dsu_restorable.hpp rename to library/dsu/dsu_restorable.hpp diff --git a/library/data_structures/dsu/kruskal_tree.hpp b/library/dsu/kruskal_tree.hpp similarity index 100% rename from library/data_structures/dsu/kruskal_tree.hpp rename to library/dsu/kruskal_tree.hpp diff --git a/library/data_structures/dsu/line_tree.hpp b/library/dsu/line_tree.hpp similarity index 100% rename from library/data_structures/dsu/line_tree.hpp rename to library/dsu/line_tree.hpp diff --git a/library/data_structures/dsu/range_parallel_dsu.hpp b/library/dsu/range_parallel_dsu.hpp similarity index 68% rename from library/data_structures/dsu/range_parallel_dsu.hpp rename to library/dsu/range_parallel_dsu.hpp index e945a35b..0a10ec58 100644 --- a/library/data_structures/dsu/range_parallel_dsu.hpp +++ b/library/dsu/range_parallel_dsu.hpp @@ -1,13 +1,13 @@ #pragma once -#include "../../../kactl/content/data-structures/UnionFind.h" +#include "dsu.hpp" //! Given l1,l2,len; joins (l1,l2), (l1+1,l2+1), //! ..., (l1+len-1,l2+len-1) //! `f` is called at most n-1 times //! @time O(n*log(n)*\alpha(n) + q) //! @space O(n log n) struct rp_dsu { - vector ufs; - rp_dsu(int n): ufs(bit_width(unsigned(n)), UF(n)) {} + vector dsus; + rp_dsu(int n): dsus(bit_width(unsigned(n)), DSU(n)) {} void join(int l1, int l2, int len, const auto& f) { if (len == 0) return; int lg = __lg(len); @@ -17,13 +17,13 @@ struct rp_dsu { } void join_impl(int lvl, int u, int v, const auto& f) { if (lvl == 0) { - u = ufs[0].find(u); - v = ufs[0].find(v); - if (!ufs[0].join(v, u)) return; - int w = ufs[0].find(u); + u = dsus[0].f(u); + v = dsus[0].f(v); + if (!dsus[0].join(v, u)) return; + int w = dsus[0].f(u); return f(w, u ^ v ^ w); } - if (!ufs[lvl].join(u, v)) return; + if (!dsus[lvl].join(u, v)) return; join_impl(lvl - 1, u, v, f); join_impl(lvl - 1, u + (1 << (lvl - 1)), v + (1 << (lvl - 1)), f); diff --git a/library/data_structures/dsu/range_parallel_equivalence_classes.hpp b/library/dsu/range_parallel_equivalence_classes.hpp similarity index 70% rename from library/data_structures/dsu/range_parallel_equivalence_classes.hpp rename to library/dsu/range_parallel_equivalence_classes.hpp index 7d30fbd7..3a5796eb 100644 --- a/library/data_structures/dsu/range_parallel_equivalence_classes.hpp +++ b/library/dsu/range_parallel_equivalence_classes.hpp @@ -1,17 +1,17 @@ #pragma once -#include "../../../kactl/content/data-structures/UnionFind.h" +#include "dsu.hpp" //! Given triplets (l1,l2,len); joins (l1,l2), //! (l1+1,l2+1), ..., (l1+len-1,l2+len-1) //! @time O((n + q) * \alpha(n)) //! @space O(n + q) -UF get_rp_dsu(const vector>& rests, int n) { +DSU get_rp_dsu(const vector>& rests, int n) { vector> rests_by_len(n + 1); for (auto [l1, l2, len] : rests) rests_by_len[len].emplace_back(l1, l2); - UF uf(n); + DSU dsu(n); for (int len = n; len > 0; len--) for (auto [l1, l2] : rests_by_len[len]) - if (uf.join(l1, l2)) + if (dsu.join(l1, l2)) rests_by_len[len - 1].emplace_back(l1 + 1, l2 + 1); - return uf; + return dsu; } diff --git a/library/graphs/bcc_callback.hpp b/library/graphs/bcc_callback.hpp index 19f9749a..034a34b5 100644 --- a/library/graphs/bcc_callback.hpp +++ b/library/graphs/bcc_callback.hpp @@ -3,7 +3,7 @@ //! @code //! { //! vector adj(n); -//! UF uf(n); +//! DSU dsu(n); //! vector seen(n); //! bcc(adj, [&](const vi& nodes) { //! int count_edges = 0; @@ -18,13 +18,13 @@ //! // nodes[0] <=> nodes[1] is a bridge //! return; //! } -//! for (int u : nodes) uf.join(u, nodes[0]); +//! for (int u : nodes) dsu.join(u, nodes[0]); //! }); //! vector> bridge_tree(n); //! rep (i, 0, n) //! for (int u : adj[i]) -//! if (!uf.sameSet(i, u)) -//! bridge_tree[uf.find(i)] += uf.find(u); +//! if (dsu.f(i) != dsu.f(u)) +//! bridge_tree[dsu.f(i)] += dsu.f(u); //! } //! //! vector> adj(n); diff --git a/library/graphs/mst.hpp b/library/graphs/mst.hpp index 0f1add26..d8261dec 100644 --- a/library/graphs/mst.hpp +++ b/library/graphs/mst.hpp @@ -1,5 +1,5 @@ #pragma once -#include "../data_structures/dsu/dsu.hpp" +#include "../dsu/dsu.hpp" //! @code //! auto [mst_cost, ids] = mst(w_eds, n); //! @endcode diff --git a/library/data_structures/binary_trie.hpp b/library/strings/binary_trie.hpp similarity index 100% rename from library/data_structures/binary_trie.hpp rename to library/strings/binary_trie.hpp diff --git a/library/strings/longest_common_subsequence/lcs_queries.hpp b/library/strings/longest_common_subsequence/lcs_queries.hpp index 25c2872d..f904bca1 100644 --- a/library/strings/longest_common_subsequence/lcs_queries.hpp +++ b/library/strings/longest_common_subsequence/lcs_queries.hpp @@ -1,5 +1,5 @@ #pragma once -#include "../../data_structures/bit.hpp" +#include "../../data_structures_[l,r)/bit.hpp" #include "lcs_dp.hpp" //! @code //! string s,t; diff --git a/library/strings/manacher/longest_palindrome_query.hpp b/library/strings/manacher/longest_palindrome_query.hpp index dd9c753b..65da93d5 100644 --- a/library/strings/manacher/longest_palindrome_query.hpp +++ b/library/strings/manacher/longest_palindrome_query.hpp @@ -1,5 +1,5 @@ #pragma once -#include "../../data_structures/rmq.hpp" +#include "../../data_structures_[l,r)/rmq.hpp" #include "manacher.hpp" //! queries for longest palindromic substring of a given //! substring diff --git a/library/strings/suffix_array/suffix_array_query.hpp b/library/strings/suffix_array/suffix_array_query.hpp index 8444b010..8f39c66c 100644 --- a/library/strings/suffix_array/suffix_array_query.hpp +++ b/library/strings/suffix_array/suffix_array_query.hpp @@ -1,6 +1,6 @@ #pragma once #include "suffix_array.hpp" -#include "../../data_structures/rmq.hpp" +#include "../../data_structures_[l,r)/rmq.hpp" #include "find/match.hpp" //! @code //! string s; diff --git a/library/trees/lca_rmq.hpp b/library/trees/lca_rmq.hpp index 9a2c325b..5f5e5227 100644 --- a/library/trees/lca_rmq.hpp +++ b/library/trees/lca_rmq.hpp @@ -1,6 +1,6 @@ #pragma once #include "../monotonic_stack/monotonic_stack.hpp" -#include "../data_structures/rmq.hpp" +#include "../data_structures_[l,r)/rmq.hpp" //! https://github.com/kth-competitive-programming/kactl/blob/main/content/graph/LCA.h //! @code //! vector> adj(n); diff --git a/library/trees/uncommon/contour_range_query.hpp b/library/trees/uncommon/contour_range_query.hpp index e2bf71fc..a0f5e747 100644 --- a/library/trees/uncommon/contour_range_query.hpp +++ b/library/trees/uncommon/contour_range_query.hpp @@ -1,5 +1,5 @@ #pragma once -#include "../../data_structures/bit.hpp" +#include "../../data_structures_[l,r)/bit.hpp" #include "../edge_cd.hpp" #include "sum_adjacent.hpp" //! https://judge.yosupo.jp/problem/vertex_add_range_contour_sum_on_tree diff --git a/library/trees/uncommon/contour_range_update.hpp b/library/trees/uncommon/contour_range_update.hpp index 80f7bf1f..b19a4be1 100644 --- a/library/trees/uncommon/contour_range_update.hpp +++ b/library/trees/uncommon/contour_range_update.hpp @@ -1,5 +1,5 @@ #pragma once -#include "../../data_structures/bit_uncommon/rupq.hpp" +#include "../../data_structures_[l,r)/bit_uncommon/rupq.hpp" #include "../edge_cd.hpp" #include "sum_adjacent.hpp" //! https://judge.yosupo.jp/problem/vertex_get_range_contour_add_on_tree diff --git a/tests/.config/.cppcheck_suppression_list b/tests/.config/.cppcheck_suppression_list index 85f4f173..160461b5 100644 --- a/tests/.config/.cppcheck_suppression_list +++ b/tests/.config/.cppcheck_suppression_list @@ -41,8 +41,8 @@ syntaxError:../library/math/prime_sieve/mobius.hpp:6 syntaxError:../library/trees/lca_rmq/iterate_subtree.hpp:6 knownConditionTrueFalse:../library/strings/suffix_array/suffix_array.hpp:62 knownConditionTrueFalse:../library/strings/suffix_array/suffix_array_short.hpp:29 -knownConditionTrueFalse:../library/data_structures/dsu/kruskal_tree.hpp:15 -knownConditionTrueFalse:../library/data_structures/dsu/dsu.hpp:11 +knownConditionTrueFalse:../library/dsu/kruskal_tree.hpp:15 +knownConditionTrueFalse:../library/dsu/dsu.hpp:11 constVariable:../kactl/content/numerical/NumberTheoreticTransform.h:30 constVariable:../kactl/content/graph/CompressTree.h:20 constVariableReference:../kactl/content/graph/CompressTree.h:20 @@ -52,11 +52,13 @@ constVariableReference:library_checker_aizu_tests/handmade_tests/dsu_size.test.c constVariableReference:../library/trees/centroid_decomp_uncommon/count_paths_per_length.hpp:34 constVariablePointer:../kactl/content/numerical/FastFourierTransform.h:39 cstyleCast:../kactl/content/numerical/FastFourierTransform.h:39 -derefInvalidIterator:../library/data_structures/uncommon/linear_rmq.hpp:27 +derefInvalidIterator:../library/data_structures_[l,r]/linear_rmq.hpp:27 derefInvalidIterator:library_checker_aizu_tests/handmade_tests/n_choose_k.test.cpp:13 unreadVariable:library_checker_aizu_tests/handmade_tests/permutation_tree_small.test.cpp:12 uninitvar:library_checker_aizu_tests/handmade_tests/seg_tree_find_small.test.cpp:41 unusedFunction:../kactl/content/data-structures/UnionFind.h:14 unusedFunction:../kactl/content/number-theory/ModPow.h:13 unusedFunction:../kactl/stress-tests/utilities/genTree.h:49 -containerOutOfBounds:../library/data_structures/uncommon/permutation_tree.hpp:85 +containerOutOfBounds:../library/data_structures_[l,r)/uncommon/permutation_tree.hpp:85 +ctuOneDefinitionRuleViolation:../library/data_structures_[l,r)/bit.hpp:5 +ctuOneDefinitionRuleViolation:../library/data_structures_[l,r)/lazy_seg_tree.hpp:4 diff --git a/tests/Makefile b/tests/Makefile index 0e663fd5..41fcb579 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -5,8 +5,6 @@ help: @echo " |" @echo "make compile_clang | compile all tests with clang, -std=c++20 for warnings" @echo " |" - @echo "make compile_commented_snippets | compile code in @code...@endcode comments" - @echo " |" @echo "make grep_clangformat_cppcheck | various greps to catch certain things, clang-format, cppcheck" @echo " |" @echo "make do_format | format with clang-format" @@ -54,6 +52,3 @@ update_main: print_which_tests_havent_run: ./scripts/print_which_tests_havent_run.sh - -compile_commented_snippets: - ./scripts/compile_commented_snippets.sh diff --git a/tests/library_checker_aizu_tests/data_structures/binary_trie.test.cpp b/tests/library_checker_aizu_tests/data_structures/binary_trie.test.cpp index de34b555..cb7a0570 100644 --- a/tests/library_checker_aizu_tests/data_structures/binary_trie.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/binary_trie.test.cpp @@ -1,7 +1,7 @@ #define PROBLEM \ "https://judge.yosupo.jp/problem/set_xor_min" #include "../template.hpp" -#include "../../../library/data_structures/binary_trie.hpp" +#include "../../../library/strings/binary_trie.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int q; diff --git a/tests/library_checker_aizu_tests/data_structures/bit.test.cpp b/tests/library_checker_aizu_tests/data_structures/bit.test.cpp index 3c328043..f0353e12 100644 --- a/tests/library_checker_aizu_tests/data_structures/bit.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/bit.test.cpp @@ -2,9 +2,9 @@ "https://judge.yosupo.jp/problem/point_add_range_sum" #include "../template.hpp" #include "../../../library/contest/random.hpp" -#include "../../../library/data_structures/bit_uncommon/rupq.hpp" -#include "../../../library/data_structures/bit_uncommon/rurq.hpp" -#include "../../../library/data_structures/lazy_seg_tree.hpp" +#include "../../../library/data_structures_[l,r)/bit_uncommon/rupq.hpp" +#include "../../../library/data_structures_[l,r)/bit_uncommon/rurq.hpp" +#include "../../../library/data_structures_[l,r)/lazy_seg_tree.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, q; diff --git a/tests/library_checker_aizu_tests/data_structures/bit_inc.test.cpp b/tests/library_checker_aizu_tests/data_structures/bit_inc.test.cpp index 7e5a39ab..c94e8302 100644 --- a/tests/library_checker_aizu_tests/data_structures/bit_inc.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/bit_inc.test.cpp @@ -1,12 +1,12 @@ #define PROBLEM \ "https://judge.yosupo.jp/problem/point_add_range_sum" #include "../template.hpp" -#include "../../../library/data_structures/bit_inc.hpp" +#include "../../../library/data_structures_[l,r]/bit.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, q; cin >> n >> q; - bit_inc bit(n); + BIT bit(n); for (int i = 0; i < n; i++) { int val; cin >> val; diff --git a/tests/library_checker_aizu_tests/data_structures/bit_ordered_set.test.cpp b/tests/library_checker_aizu_tests/data_structures/bit_ordered_set.test.cpp index 8393616b..3349d015 100644 --- a/tests/library_checker_aizu_tests/data_structures/bit_ordered_set.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/bit_ordered_set.test.cpp @@ -1,7 +1,7 @@ #define PROBLEM \ "https://judge.yosupo.jp/problem/ordered_set" #include "../template.hpp" -#include "../../../library/data_structures/bit_inc.hpp" +#include "../../../library/data_structures_[l,r]/bit.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, q; @@ -18,7 +18,7 @@ int main() { } ranges::sort(compress); compress.erase(unique(all(compress)), end(compress)); - bit_inc bit(ssize(compress)); + BIT bit(ssize(compress)); auto get_compressed_idx = [&](int val) -> int { int l = 0, r = ssize(compress); while (l + 1 < r) { diff --git a/tests/library_checker_aizu_tests/data_structures/bit_rupq.test.cpp b/tests/library_checker_aizu_tests/data_structures/bit_rupq.test.cpp index 49b54b42..150ba99c 100644 --- a/tests/library_checker_aizu_tests/data_structures/bit_rupq.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/bit_rupq.test.cpp @@ -1,7 +1,7 @@ #define PROBLEM \ "https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_E" #include "../template.hpp" -#include "../../../library/data_structures/bit_uncommon/rupq.hpp" +#include "../../../library/data_structures_[l,r)/bit_uncommon/rupq.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, q; diff --git a/tests/library_checker_aizu_tests/data_structures/bit_rurq.test.cpp b/tests/library_checker_aizu_tests/data_structures/bit_rurq.test.cpp index d561be4f..87ef1666 100644 --- a/tests/library_checker_aizu_tests/data_structures/bit_rurq.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/bit_rurq.test.cpp @@ -1,7 +1,7 @@ #define PROBLEM \ "https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_G" #include "../template.hpp" -#include "../../../library/data_structures/bit_uncommon/rurq.hpp" +#include "../../../library/data_structures_[l,r)/bit_uncommon/rurq.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, q; diff --git a/tests/library_checker_aizu_tests/data_structures/bit_walk.test.cpp b/tests/library_checker_aizu_tests/data_structures/bit_walk.test.cpp index 6069c731..b990da0e 100644 --- a/tests/library_checker_aizu_tests/data_structures/bit_walk.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/bit_walk.test.cpp @@ -1,8 +1,8 @@ #define PROBLEM \ "https://judge.yosupo.jp/problem/predecessor_problem" #include "../template.hpp" -#include "../../../library/data_structures/bit.hpp" -#include "../../../library/data_structures/lazy_seg_tree.hpp" +#include "../../../library/data_structures_[l,r)/bit.hpp" +#include "../../../library/data_structures_[l,r)/lazy_seg_tree.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, q; diff --git a/tests/library_checker_aizu_tests/data_structures/deque.test.cpp b/tests/library_checker_aizu_tests/data_structures/deque.test.cpp index 30e25494..a7468a61 100644 --- a/tests/library_checker_aizu_tests/data_structures/deque.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/deque.test.cpp @@ -1,7 +1,7 @@ #define PROBLEM \ "https://onlinejudge.u-aizu.ac.jp/courses/lesson/8/ITP2/all/ITP2_1_B" #include "../template.hpp" -#include "../../../library/data_structures/uncommon/deque_op.hpp" +#include "../../../library/data_structures_[l,r)/uncommon/deque_op.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int q; diff --git a/tests/library_checker_aizu_tests/data_structures/deque_index.test.cpp b/tests/library_checker_aizu_tests/data_structures/deque_index.test.cpp index 52f89ffb..969e0dcb 100644 --- a/tests/library_checker_aizu_tests/data_structures/deque_index.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/deque_index.test.cpp @@ -1,6 +1,6 @@ #define PROBLEM "https://judge.yosupo.jp/problem/deque" #include "../template.hpp" -#include "../../../library/data_structures/uncommon/deque_op.hpp" +#include "../../../library/data_structures_[l,r)/uncommon/deque_op.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int q; diff --git a/tests/library_checker_aizu_tests/data_structures/deque_op.test.cpp b/tests/library_checker_aizu_tests/data_structures/deque_op.test.cpp index 91d0e21c..2b253ebd 100644 --- a/tests/library_checker_aizu_tests/data_structures/deque_op.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/deque_op.test.cpp @@ -2,7 +2,7 @@ "https://judge.yosupo.jp/problem/deque_operate_all_composite" #include "../template.hpp" #include "../../../library/contest/random.hpp" -#include "../../../library/data_structures/uncommon/deque_op.hpp" +#include "../../../library/data_structures_[l,r)/uncommon/deque_op.hpp" int main() { cin.tie(0)->sync_with_stdio(0); const int mod = 998'244'353; diff --git a/tests/library_checker_aizu_tests/data_structures/deque_sliding_window.test.cpp b/tests/library_checker_aizu_tests/data_structures/deque_sliding_window.test.cpp index 193d272c..07b19a0a 100644 --- a/tests/library_checker_aizu_tests/data_structures/deque_sliding_window.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/deque_sliding_window.test.cpp @@ -1,7 +1,7 @@ #define PROBLEM \ "https://onlinejudge.u-aizu.ac.jp/courses/library/3/DSL/all/DSL_3_D" #include "../template.hpp" -#include "../../../library/data_structures/uncommon/deque_op.hpp" +#include "../../../library/data_structures_[l,r)/uncommon/deque_op.hpp" int mn(int x, int y) { return min(x, y); } int main() { cin.tie(0)->sync_with_stdio(0); diff --git a/tests/library_checker_aizu_tests/data_structures/disjoint_rmq_inc.test.cpp b/tests/library_checker_aizu_tests/data_structures/disjoint_rmq_inc.test.cpp index 970d3dff..1c5367d3 100644 --- a/tests/library_checker_aizu_tests/data_structures/disjoint_rmq_inc.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/disjoint_rmq_inc.test.cpp @@ -1,13 +1,13 @@ #define PROBLEM "https://judge.yosupo.jp/problem/staticrmq" #include "../template.hpp" -#include "../../../library/data_structures/uncommon/disjoint_rmq_inc.hpp" +#include "../../../library/data_structures_[l,r]/disjoint_rmq.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, q; cin >> n >> q; vi a(n); for (int i = 0; i < n; i++) cin >> a[i]; - disjoint_rmq_inc rmq(a, + disjoint_rmq rmq(a, [](int x, int y) { return min(x, y); }); while (q--) { int l, r; diff --git a/tests/library_checker_aizu_tests/data_structures/disjoint_rmq_inc_lines.test.cpp b/tests/library_checker_aizu_tests/data_structures/disjoint_rmq_inc_lines.test.cpp index 359a849c..07e0a2d5 100644 --- a/tests/library_checker_aizu_tests/data_structures/disjoint_rmq_inc_lines.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/disjoint_rmq_inc_lines.test.cpp @@ -1,7 +1,7 @@ #define PROBLEM \ "https://judge.yosupo.jp/problem/queue_operate_all_composite" #include "../template.hpp" -#include "../../../library/data_structures/uncommon/disjoint_rmq_inc.hpp" +#include "../../../library/data_structures_[l,r]/disjoint_rmq.hpp" int main() { cin.tie(0)->sync_with_stdio(0); const ll mod = 998'244'353; @@ -20,7 +20,7 @@ int main() { lines.emplace_back(queries[i].a, queries[i].b); } else if (queries[i].type == 2) cin >> queries[i].x; } - disjoint_rmq_inc rmq(lines, + disjoint_rmq rmq(lines, [](const auto& a, const auto& b) { // f1(x) = a.first * x + a.second // f2(x) = b.first * x + b.second diff --git a/tests/library_checker_aizu_tests/data_structures/disjoint_rmq_sum.test.cpp b/tests/library_checker_aizu_tests/data_structures/disjoint_rmq_inc_sum.test.cpp similarity index 76% rename from tests/library_checker_aizu_tests/data_structures/disjoint_rmq_sum.test.cpp rename to tests/library_checker_aizu_tests/data_structures/disjoint_rmq_inc_sum.test.cpp index a812f5db..51f980d8 100644 --- a/tests/library_checker_aizu_tests/data_structures/disjoint_rmq_sum.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/disjoint_rmq_inc_sum.test.cpp @@ -1,7 +1,7 @@ #define PROBLEM \ "https://judge.yosupo.jp/problem/static_range_sum" #include "../template.hpp" -#include "../../../library/data_structures/uncommon/disjoint_rmq.hpp" +#include "../../../library/data_structures_[l,r]/disjoint_rmq.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, q; @@ -12,6 +12,6 @@ int main() { while (q--) { int l, r; cin >> l >> r; - cout << rmq.query(l, r) << '\n'; + cout << rmq.query(l, r - 1) << '\n'; } } diff --git a/tests/library_checker_aizu_tests/data_structures/disjoint_rmq_lines.test.cpp b/tests/library_checker_aizu_tests/data_structures/disjoint_rmq_lines.test.cpp deleted file mode 100644 index ea747377..00000000 --- a/tests/library_checker_aizu_tests/data_structures/disjoint_rmq_lines.test.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#define PROBLEM \ - "https://judge.yosupo.jp/problem/queue_operate_all_composite" -#include "../template.hpp" -#include "../../../library/data_structures/uncommon/disjoint_rmq.hpp" -int main() { - cin.tie(0)->sync_with_stdio(0); - const ll mod = 998'244'353; - int q; - cin >> q; - struct query { - int type; - int a, b, x; - }; - vector queries(q); - vector> lines; - for (int i = 0; i < q; i++) { - cin >> queries[i].type; - if (queries[i].type == 0) { - cin >> queries[i].a >> queries[i].b; - lines.emplace_back(queries[i].a, queries[i].b); - } else if (queries[i].type == 2) cin >> queries[i].x; - } - disjoint_rmq rmq(lines, - [](const auto& a, const auto& b) { - // f1(x) = a.first * x + a.second - // f2(x) = b.first * x + b.second - // f2(f1(x)) = b.first * (a.first * x + a.second) + - // b.second - // = (a.first * b.first) * x + (b.first * - // a.second + b.second) - return pair(a.first * b.first % mod, - (b.first * a.second + b.second) % mod); - }); - int l = 0, r = 0; // range [l, r) - for (const auto& curr : queries) { - if (curr.type == 0) r++; - else if (curr.type == 1) l++; - else { - if (l == r) cout << curr.x << '\n'; - else { - auto [slope, y_int] = rmq.query(l, r); - cout << (slope * curr.x + y_int) % mod << '\n'; - } - } - } - return 0; -} diff --git a/tests/library_checker_aizu_tests/data_structures/distinct_query.test.cpp b/tests/library_checker_aizu_tests/data_structures/distinct_query.test.cpp index 10e106ef..0982372a 100644 --- a/tests/library_checker_aizu_tests/data_structures/distinct_query.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/distinct_query.test.cpp @@ -1,7 +1,7 @@ #define PROBLEM \ "https://judge.yosupo.jp/problem/static_range_count_distinct" #include "../template.hpp" -#include "../../../library/data_structures/seg_tree_uncommon/distinct_query.hpp" +#include "../../../library/data_structures_[l,r)/seg_tree_uncommon/distinct_query.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, q; diff --git a/tests/library_checker_aizu_tests/data_structures/dsu.test.cpp b/tests/library_checker_aizu_tests/data_structures/dsu.test.cpp index fe79d086..ff829311 100644 --- a/tests/library_checker_aizu_tests/data_structures/dsu.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/dsu.test.cpp @@ -1,6 +1,6 @@ #define PROBLEM "https://judge.yosupo.jp/problem/unionfind" #include "../template.hpp" -#include "../../../library/data_structures/dsu/dsu.hpp" +#include "../../../library/dsu/dsu.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, q; diff --git a/tests/library_checker_aizu_tests/data_structures/dsu_bipartite.test.cpp b/tests/library_checker_aizu_tests/data_structures/dsu_bipartite.test.cpp index 2b64b760..77b46f82 100644 --- a/tests/library_checker_aizu_tests/data_structures/dsu_bipartite.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/dsu_bipartite.test.cpp @@ -1,6 +1,6 @@ #define PROBLEM "https://judge.yosupo.jp/problem/unionfind" #include "../template.hpp" -#include "../../../library/data_structures/dsu/dsu_bipartite.hpp" +#include "../../../library/dsu/dsu_bipartite.hpp" #include "../../../library/contest/random.hpp" vector bipartite_check( const vector>& adj) { diff --git a/tests/library_checker_aizu_tests/data_structures/dsu_restorable.test.cpp b/tests/library_checker_aizu_tests/data_structures/dsu_restorable.test.cpp index 29642ff1..2dce308f 100644 --- a/tests/library_checker_aizu_tests/data_structures/dsu_restorable.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/dsu_restorable.test.cpp @@ -1,7 +1,7 @@ #define PROBLEM \ "https://judge.yosupo.jp/problem/persistent_unionfind" #include "../template.hpp" -#include "../../../library/data_structures/dsu/dsu_restorable.hpp" +#include "../../../library/dsu/dsu_restorable.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, q; diff --git a/tests/library_checker_aizu_tests/data_structures/dsu_segtree_undo_trick.test.cpp b/tests/library_checker_aizu_tests/data_structures/dsu_segtree_undo_trick.test.cpp index 2c76e8d6..f9ea716d 100644 --- a/tests/library_checker_aizu_tests/data_structures/dsu_segtree_undo_trick.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/dsu_segtree_undo_trick.test.cpp @@ -1,8 +1,8 @@ #define PROBLEM \ "https://judge.yosupo.jp/problem/dynamic_graph_vertex_add_component_sum" #include "../template.hpp" -#include "../../../library/data_structures/dsu/dsu_restorable.hpp" -#include "../../../library/data_structures/lazy_seg_tree.hpp" +#include "../../../library//dsu/dsu_restorable.hpp" +#include "../../../library/data_structures_[l,r)/lazy_seg_tree.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, q; diff --git a/tests/library_checker_aizu_tests/data_structures/implicit_seg_tree.test.cpp b/tests/library_checker_aizu_tests/data_structures/implicit_seg_tree.test.cpp index 683af629..0d828758 100644 --- a/tests/library_checker_aizu_tests/data_structures/implicit_seg_tree.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/implicit_seg_tree.test.cpp @@ -1,7 +1,7 @@ #define PROBLEM \ "https://judge.yosupo.jp/problem/area_of_union_of_rectangles" #include "../template.hpp" -#include "../../../library/data_structures/seg_tree_uncommon/implicit.hpp" +#include "../../../library/data_structures_[l,r)/seg_tree_uncommon/implicit.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n; diff --git a/tests/library_checker_aizu_tests/data_structures/kruskal_tree_aizu.test.cpp b/tests/library_checker_aizu_tests/data_structures/kruskal_tree_aizu.test.cpp index 77cac40a..28e3edf3 100644 --- a/tests/library_checker_aizu_tests/data_structures/kruskal_tree_aizu.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/kruskal_tree_aizu.test.cpp @@ -1,7 +1,7 @@ #define PROBLEM \ "https://onlinejudge.u-aizu.ac.jp/problems/ALDS1_12_A" #include "../template.hpp" -#include "../../../library/data_structures/dsu/kruskal_tree.hpp" +#include "../../../library/dsu/kruskal_tree.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n; diff --git a/tests/library_checker_aizu_tests/data_structures/kth_smallest_pst.test.cpp b/tests/library_checker_aizu_tests/data_structures/kth_smallest_pst.test.cpp index 3a7f1e81..a7359c75 100644 --- a/tests/library_checker_aizu_tests/data_structures/kth_smallest_pst.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/kth_smallest_pst.test.cpp @@ -1,7 +1,7 @@ #define PROBLEM \ "https://judge.yosupo.jp/problem/range_kth_smallest" #include "../template.hpp" -#include "../../../library/data_structures/seg_tree_uncommon/kth_smallest_query.hpp" +#include "../../../library/data_structures_[l,r)/seg_tree_uncommon/kth_smallest_query.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, q; diff --git a/tests/library_checker_aizu_tests/data_structures/kth_smallest_wavelet_matrix.test.cpp b/tests/library_checker_aizu_tests/data_structures/kth_smallest_wavelet_matrix.test.cpp index 95ec3365..7b0c0c04 100644 --- a/tests/library_checker_aizu_tests/data_structures/kth_smallest_wavelet_matrix.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/kth_smallest_wavelet_matrix.test.cpp @@ -1,7 +1,7 @@ #define PROBLEM \ "https://judge.yosupo.jp/problem/range_kth_smallest" #include "../template.hpp" -#include "../../../library/data_structures/seg_tree_uncommon/wavelet_matrix.hpp" +#include "../../../library/data_structures_[l,r)/seg_tree_uncommon/wavelet_matrix.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, q; diff --git a/tests/library_checker_aizu_tests/data_structures/lazy_segment_tree.test.cpp b/tests/library_checker_aizu_tests/data_structures/lazy_segment_tree.test.cpp index 45b8d80c..e219b6a7 100644 --- a/tests/library_checker_aizu_tests/data_structures/lazy_segment_tree.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/lazy_segment_tree.test.cpp @@ -1,7 +1,7 @@ #define PROBLEM \ "https://onlinejudge.u-aizu.ac.jp/courses/library/3/DSL/all/DSL_2_G" #include "../template.hpp" -#include "../../../library/data_structures/lazy_seg_tree.hpp" +#include "../../../library/data_structures_[l,r)/lazy_seg_tree.hpp" int main() { cin.tie(0)->sync_with_stdio(0); { diff --git a/tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_constructor.test.cpp b/tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_constructor.test.cpp index dce7702f..84889e9f 100644 --- a/tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_constructor.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_constructor.test.cpp @@ -1,7 +1,7 @@ #define PROBLEM \ "https://judge.yosupo.jp/problem/point_add_range_sum" #include "../template.hpp" -#include "../../../library/data_structures/lazy_seg_tree.hpp" +#include "../../../library/data_structures_[l,r)/lazy_seg_tree.hpp" int main() { cin.tie(0)->sync_with_stdio(0); { diff --git a/tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_inc.test.cpp b/tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_inc.test.cpp index 1dec9fc3..08a572f3 100644 --- a/tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_inc.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_inc.test.cpp @@ -1,12 +1,12 @@ #define PROBLEM \ "https://onlinejudge.u-aizu.ac.jp/courses/library/3/DSL/all/DSL_2_G" #include "../template.hpp" -#include "../../../library/data_structures/lazy_seg_tree_inc.hpp" +#include "../../../library/data_structures_[l,r]/lazy_seg_tree.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, q; cin >> n >> q; - seg_tree_inc st(n); + seg_tree st(n); while (q--) { int type, l, r; cin >> type >> l >> r; diff --git a/tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_inc_constructor.test.cpp b/tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_inc_constructor.test.cpp index 2786e101..675c0f55 100644 --- a/tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_inc_constructor.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_inc_constructor.test.cpp @@ -1,14 +1,14 @@ #define PROBLEM \ "https://judge.yosupo.jp/problem/point_add_range_sum" #include "../template.hpp" -#include "../../../library/data_structures/lazy_seg_tree_inc.hpp" +#include "../../../library/data_structures_[l,r]/lazy_seg_tree.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, q; cin >> n >> q; vector a(n); for (int i = 0; i < n; i++) cin >> a[i]; - seg_tree_inc st(a); + seg_tree st(a); while (q--) { int type; cin >> type; diff --git a/tests/library_checker_aizu_tests/data_structures/line_tree_aizu.test.cpp b/tests/library_checker_aizu_tests/data_structures/line_tree_aizu.test.cpp index d9400ddf..9efbd9ed 100644 --- a/tests/library_checker_aizu_tests/data_structures/line_tree_aizu.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/line_tree_aizu.test.cpp @@ -1,8 +1,8 @@ #define PROBLEM \ "https://onlinejudge.u-aizu.ac.jp/problems/ALDS1_12_A" #include "../template.hpp" -#include "../../../library/data_structures/dsu/line_tree.hpp" -#include "../../../library/data_structures/rmq.hpp" +#include "../../../library/dsu/line_tree.hpp" +#include "../../../library/data_structures_[l,r)/rmq.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n; diff --git a/tests/library_checker_aizu_tests/data_structures/line_tree_lib_checker.test.cpp b/tests/library_checker_aizu_tests/data_structures/line_tree_lib_checker.test.cpp index 2b6acb51..65b3c5e4 100644 --- a/tests/library_checker_aizu_tests/data_structures/line_tree_lib_checker.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/line_tree_lib_checker.test.cpp @@ -1,8 +1,8 @@ #define PROBLEM \ "https://judge.yosupo.jp/problem/minimum_spanning_tree" #include "../template.hpp" -#include "../../../library/data_structures/dsu/line_tree.hpp" -#include "../../../library/data_structures/dsu/kruskal_tree.hpp" +#include "../../../library/dsu/line_tree.hpp" +#include "../../../library/dsu/kruskal_tree.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, m; diff --git a/tests/library_checker_aizu_tests/data_structures/merge_sort_tree.test.cpp b/tests/library_checker_aizu_tests/data_structures/merge_sort_tree.test.cpp index 4ec6e472..2345f476 100644 --- a/tests/library_checker_aizu_tests/data_structures/merge_sort_tree.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/merge_sort_tree.test.cpp @@ -4,7 +4,7 @@ // to `lower_bound`, causing TLE. #undef _GLIBCXX_DEBUG #include "../template.hpp" -#include "../../../library/data_structures/seg_tree_uncommon/merge_sort_tree.hpp" +#include "../../../library/data_structures_[l,r)/seg_tree_uncommon/merge_sort_tree.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, q; diff --git a/tests/library_checker_aizu_tests/data_structures/mode_query.test.cpp b/tests/library_checker_aizu_tests/data_structures/mode_query.test.cpp index 1a2ad5da..b4fabb4e 100644 --- a/tests/library_checker_aizu_tests/data_structures/mode_query.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/mode_query.test.cpp @@ -1,7 +1,7 @@ #define PROBLEM \ "https://judge.yosupo.jp/problem/static_range_mode_query" #include "../template.hpp" -#include "../../../library/data_structures/uncommon/mode_query.hpp" +#include "../../../library/data_structures_[l,r)/uncommon/mode_query.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, q; diff --git a/tests/library_checker_aizu_tests/data_structures/permutation_tree.test.cpp b/tests/library_checker_aizu_tests/data_structures/permutation_tree.test.cpp index 0e2a55ef..79ca332c 100644 --- a/tests/library_checker_aizu_tests/data_structures/permutation_tree.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/permutation_tree.test.cpp @@ -2,7 +2,7 @@ "https://judge.yosupo.jp/problem/common_interval_decomposition_tree" #include "../template.hpp" #include "../perm_tree_asserts.hpp" -#include "../../../library/data_structures/uncommon/permutation_tree.hpp" +#include "../../../library/data_structures_[l,r)/uncommon/permutation_tree.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n; diff --git a/tests/library_checker_aizu_tests/data_structures/persistent_queue_tree.test.cpp b/tests/library_checker_aizu_tests/data_structures/persistent_queue_tree.test.cpp index 321e58e5..e0e531bc 100644 --- a/tests/library_checker_aizu_tests/data_structures/persistent_queue_tree.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/persistent_queue_tree.test.cpp @@ -1,7 +1,7 @@ #define PROBLEM \ "https://judge.yosupo.jp/problem/persistent_queue" #include "../template.hpp" -#include "../../../library/data_structures/seg_tree_uncommon/persistent.hpp" +#include "../../../library/data_structures_[l,r)/seg_tree_uncommon/persistent.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int q; diff --git a/tests/library_checker_aizu_tests/data_structures/persistent_seg_tree.test.cpp b/tests/library_checker_aizu_tests/data_structures/persistent_seg_tree.test.cpp index 8480b43f..50d77877 100644 --- a/tests/library_checker_aizu_tests/data_structures/persistent_seg_tree.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/persistent_seg_tree.test.cpp @@ -4,7 +4,7 @@ // to `lower_bound`, causing TLE. #undef _GLIBCXX_DEBUG #include "../template.hpp" -#include "../../../library/data_structures/seg_tree_uncommon/persistent.hpp" +#include "../../../library/data_structures_[l,r)/seg_tree_uncommon/persistent.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, q; diff --git a/tests/library_checker_aizu_tests/data_structures/pq_ds_undo_sliding_window.test.cpp b/tests/library_checker_aizu_tests/data_structures/pq_ds_undo_sliding_window.test.cpp index b0b27a4e..83e4c8d2 100644 --- a/tests/library_checker_aizu_tests/data_structures/pq_ds_undo_sliding_window.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/pq_ds_undo_sliding_window.test.cpp @@ -4,7 +4,7 @@ // operations to be O(n) #undef _GLIBCXX_DEBUG #include "../template.hpp" -#include "../../../library/data_structures/uncommon/priority_queue_of_updates.hpp" +#include "../../../library/data_structures_[l,r)/uncommon/priority_queue_of_updates.hpp" struct stack_with_get_max { vector> st; void join(int val) { diff --git a/tests/library_checker_aizu_tests/data_structures/pq_ds_undo_with_dsu.test.cpp b/tests/library_checker_aizu_tests/data_structures/pq_ds_undo_with_dsu.test.cpp index 16c9de9b..16ed0c12 100644 --- a/tests/library_checker_aizu_tests/data_structures/pq_ds_undo_with_dsu.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/pq_ds_undo_with_dsu.test.cpp @@ -4,8 +4,8 @@ // operations to be O(n) #undef _GLIBCXX_DEBUG #include "../template.hpp" -#include "../../../library/data_structures/dsu/dsu_restorable.hpp" -#include "../../../library/data_structures/uncommon/priority_queue_of_updates.hpp" +#include "../../../library/dsu/dsu_restorable.hpp" +#include "../../../library/data_structures_[l,r)/uncommon/priority_queue_of_updates.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, q; diff --git a/tests/library_checker_aizu_tests/data_structures/range_parallel_dsu.test.cpp b/tests/library_checker_aizu_tests/data_structures/range_parallel_dsu.test.cpp index af7a24cd..b4b46597 100644 --- a/tests/library_checker_aizu_tests/data_structures/range_parallel_dsu.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/range_parallel_dsu.test.cpp @@ -2,8 +2,8 @@ "https://judge.yosupo.jp/problem/range_parallel_unionfind" #undef _GLIBCXX_DEBUG #include "../template.hpp" -#include "../../../library/data_structures/dsu/range_parallel_dsu.hpp" -#include "../../../library/data_structures/dsu/range_parallel_equivalence_classes.hpp" +#include "../../../library/dsu/range_parallel_dsu.hpp" +#include "../../../library/dsu/range_parallel_equivalence_classes.hpp" const int mod = 998244353; int main() { cin.tie(0)->sync_with_stdio(0); @@ -32,7 +32,7 @@ int main() { vi sums(n); int offline_ans = 0; for (int i = 0; i < n; i++) { - int id = uf.find(i); + int id = uf.f(i); offline_ans = (offline_ans + 1LL * sums[id] * y[i]) % mod; sums[id] = (sums[id] + y[i]) % mod; diff --git a/tests/library_checker_aizu_tests/data_structures/rmq_disjoint_sparse_table.test.cpp b/tests/library_checker_aizu_tests/data_structures/rmq_disjoint_sparse_table.test.cpp deleted file mode 100644 index 10924cc2..00000000 --- a/tests/library_checker_aizu_tests/data_structures/rmq_disjoint_sparse_table.test.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#define PROBLEM "https://judge.yosupo.jp/problem/staticrmq" -#include "../template.hpp" -#include "../../../library/data_structures/uncommon/disjoint_rmq.hpp" -int main() { - cin.tie(0)->sync_with_stdio(0); - int n, q; - cin >> n >> q; - vector a(n); - for (int i = 0; i < n; i++) cin >> a[i]; - disjoint_rmq dis_rmq(a, ranges::min); - while (q--) { - int l, r; - cin >> l >> r; - cout << dis_rmq.query(l, r) << '\n'; - } -} diff --git a/tests/library_checker_aizu_tests/data_structures/rmq_linear.test.cpp b/tests/library_checker_aizu_tests/data_structures/rmq_linear.test.cpp index fb3de419..deb7bdd0 100644 --- a/tests/library_checker_aizu_tests/data_structures/rmq_linear.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/rmq_linear.test.cpp @@ -1,6 +1,6 @@ #define PROBLEM "https://judge.yosupo.jp/problem/staticrmq" #include "../template.hpp" -#include "../../../library/data_structures/uncommon/linear_rmq.hpp" +#include "../../../library/data_structures_[l,r]/linear_rmq.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, q; diff --git a/tests/library_checker_aizu_tests/data_structures/rmq_sparse_table.test.cpp b/tests/library_checker_aizu_tests/data_structures/rmq_sparse_table.test.cpp index 60f27454..ff21e260 100644 --- a/tests/library_checker_aizu_tests/data_structures/rmq_sparse_table.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/rmq_sparse_table.test.cpp @@ -1,7 +1,7 @@ #define PROBLEM "https://judge.yosupo.jp/problem/staticrmq" #include "../template.hpp" #include "../mono_st_asserts.hpp" -#include "../../../library/data_structures/rmq.hpp" +#include "../../../library/data_structures_[l,r)/rmq.hpp" int mn(int x, int y) { return min(x, y); } int main() { cin.tie(0)->sync_with_stdio(0); diff --git a/tests/library_checker_aizu_tests/data_structures/rmq_sparse_table_inc.test.cpp b/tests/library_checker_aizu_tests/data_structures/rmq_sparse_table_inc.test.cpp index aca314c6..66ca9acb 100644 --- a/tests/library_checker_aizu_tests/data_structures/rmq_sparse_table_inc.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/rmq_sparse_table_inc.test.cpp @@ -1,13 +1,13 @@ #define PROBLEM "https://judge.yosupo.jp/problem/staticrmq" #include "../template.hpp" -#include "../../../library/data_structures/rmq_inc.hpp" +#include "../../../library/data_structures_[l,r]/rmq.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, q; cin >> n >> q; vector a(n); for (int i = 0; i < n; i++) cin >> a[i]; - rmq_inc rmq(a, ranges::min); + RMQ rmq(a, ranges::min); while (q--) { int l, r; cin >> l >> r; diff --git a/tests/library_checker_aizu_tests/data_structures/simple_tree.test.cpp b/tests/library_checker_aizu_tests/data_structures/simple_tree.test.cpp index 56afe9ff..0abd958b 100644 --- a/tests/library_checker_aizu_tests/data_structures/simple_tree.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/simple_tree.test.cpp @@ -1,7 +1,7 @@ #define PROBLEM \ "https://onlinejudge.u-aizu.ac.jp/problems/DSL_2_A" #include "../template.hpp" -#include "../../../library/data_structures/seg_tree.hpp" +#include "../../../library/data_structures_[l,r)/seg_tree.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, q; diff --git a/tests/library_checker_aizu_tests/data_structures/simple_tree_inc.test.cpp b/tests/library_checker_aizu_tests/data_structures/simple_tree_inc.test.cpp index 69f09256..708780ca 100644 --- a/tests/library_checker_aizu_tests/data_structures/simple_tree_inc.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/simple_tree_inc.test.cpp @@ -1,12 +1,12 @@ #define PROBLEM \ "https://onlinejudge.u-aizu.ac.jp/problems/DSL_2_A" #include "../template.hpp" -#include "../../../library/data_structures/seg_tree_inc.hpp" +#include "../../../library/data_structures_[l,r]/seg_tree.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, q; cin >> n >> q; - tree_inc st(n, int{}, ranges::min); + tree st(n, int{}, ranges::min); rep(i, 0, n) st.update(i, INT_MAX); while (q--) { int type; diff --git a/tests/library_checker_aizu_tests/data_structures/simple_tree_inc_line.test.cpp b/tests/library_checker_aizu_tests/data_structures/simple_tree_inc_line.test.cpp index 76ff0f99..d0b25f30 100644 --- a/tests/library_checker_aizu_tests/data_structures/simple_tree_inc_line.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/simple_tree_inc_line.test.cpp @@ -1,13 +1,13 @@ #define PROBLEM \ "https://judge.yosupo.jp/problem/point_set_range_composite" #include "../template.hpp" -#include "../../../library/data_structures/seg_tree_inc.hpp" +#include "../../../library/data_structures_[l,r]/seg_tree.hpp" const int mod = 998'244'353; int main() { cin.tie(0)->sync_with_stdio(0); int n, q; cin >> n >> q; - tree_inc st(n, array{}, + tree st(n, array{}, [&](const array& l, const array& r) -> array { return {int(1LL * l[0] * r[0] % mod), diff --git a/tests/library_checker_aizu_tests/data_structures/simple_tree_line.test.cpp b/tests/library_checker_aizu_tests/data_structures/simple_tree_line.test.cpp index 11208946..78ee4474 100644 --- a/tests/library_checker_aizu_tests/data_structures/simple_tree_line.test.cpp +++ b/tests/library_checker_aizu_tests/data_structures/simple_tree_line.test.cpp @@ -1,7 +1,7 @@ #define PROBLEM \ "https://judge.yosupo.jp/problem/point_set_range_composite" #include "../template.hpp" -#include "../../../library/data_structures/seg_tree.hpp" +#include "../../../library/data_structures_[l,r)/seg_tree.hpp" const int mod = 998'244'353; int main() { cin.tie(0)->sync_with_stdio(0); diff --git a/tests/library_checker_aizu_tests/graphs/bcc_callback_lib_checker_two_cc.test.cpp b/tests/library_checker_aizu_tests/graphs/bcc_callback_lib_checker_two_cc.test.cpp index 23757d25..d501ff5b 100644 --- a/tests/library_checker_aizu_tests/graphs/bcc_callback_lib_checker_two_cc.test.cpp +++ b/tests/library_checker_aizu_tests/graphs/bcc_callback_lib_checker_two_cc.test.cpp @@ -2,7 +2,7 @@ "https://judge.yosupo.jp/problem/two_edge_connected_components" #include "../template.hpp" #include "../../../library/graphs/bcc_callback.hpp" -#include "../../../library/data_structures/dsu/dsu.hpp" +#include "../../../library/dsu/dsu.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, m; diff --git a/tests/library_checker_aizu_tests/graphs/offline_incremental_scc.test.cpp b/tests/library_checker_aizu_tests/graphs/offline_incremental_scc.test.cpp index 22f8b706..a0e71b1b 100644 --- a/tests/library_checker_aizu_tests/graphs/offline_incremental_scc.test.cpp +++ b/tests/library_checker_aizu_tests/graphs/offline_incremental_scc.test.cpp @@ -2,7 +2,7 @@ "https://judge.yosupo.jp/problem/incremental_scc" #include "../template.hpp" #include "../../../library/graphs/strongly_connected_components/offline_incremental_scc.hpp" -#include "../../../library/data_structures/dsu/dsu.hpp" +#include "../../../library/dsu/dsu.hpp" const int mod = 998244353; int main() { cin.tie(0)->sync_with_stdio(0); diff --git a/tests/library_checker_aizu_tests/graphs/two_edge_components.test.cpp b/tests/library_checker_aizu_tests/graphs/two_edge_components.test.cpp index f12fbcad..be5f84be 100644 --- a/tests/library_checker_aizu_tests/graphs/two_edge_components.test.cpp +++ b/tests/library_checker_aizu_tests/graphs/two_edge_components.test.cpp @@ -2,7 +2,7 @@ "https://judge.yosupo.jp/problem/two_edge_connected_components" #include "../template.hpp" #include "../../../library/graphs/uncommon/bridge_tree.hpp" -#include "../../../library/data_structures/dsu/dsu_restorable.hpp" +#include "../../../library/dsu/dsu_restorable.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, m; diff --git a/tests/library_checker_aizu_tests/handmade_tests/dsu.test.cpp b/tests/library_checker_aizu_tests/handmade_tests/dsu.test.cpp index 410c6b00..8f297dad 100644 --- a/tests/library_checker_aizu_tests/handmade_tests/dsu.test.cpp +++ b/tests/library_checker_aizu_tests/handmade_tests/dsu.test.cpp @@ -2,7 +2,7 @@ "https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_A" #include "../template.hpp" #include "../../../library/contest/random.hpp" -#include "../../../library/data_structures/dsu/dsu.hpp" +#include "../../../library/dsu/dsu.hpp" int main() { cin.tie(0)->sync_with_stdio(0); for (int n = 0; n <= 100; n++) { diff --git a/tests/library_checker_aizu_tests/handmade_tests/dsu_size.test.cpp b/tests/library_checker_aizu_tests/handmade_tests/dsu_size.test.cpp index edc0a2a9..3e8b594e 100644 --- a/tests/library_checker_aizu_tests/handmade_tests/dsu_size.test.cpp +++ b/tests/library_checker_aizu_tests/handmade_tests/dsu_size.test.cpp @@ -2,7 +2,7 @@ "https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_A" #include "../template.hpp" #include "../../../library/contest/random.hpp" -#include "../../../library/data_structures/dsu/dsu_restorable.hpp" +#include "../../../library/dsu/dsu_restorable.hpp" int main() { cin.tie(0)->sync_with_stdio(0); for (int n = 1; n < 100; n++) { diff --git a/tests/library_checker_aizu_tests/handmade_tests/hilbert_mos.test.cpp b/tests/library_checker_aizu_tests/handmade_tests/hilbert_mos.test.cpp index b05f4fab..aec0a3e7 100644 --- a/tests/library_checker_aizu_tests/handmade_tests/hilbert_mos.test.cpp +++ b/tests/library_checker_aizu_tests/handmade_tests/hilbert_mos.test.cpp @@ -2,7 +2,7 @@ "https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_A" #include "../template.hpp" #include "../../../library/contest/random.hpp" -#include "../../../library/data_structures/uncommon/hilbert_mos.hpp" +#include "../../../library/data_structures_[l,r)/uncommon/hilbert_mos.hpp" const vector di = {1, -1, 0, 0}; const vector dj = {0, 0, 1, -1}; void test(int i, int j) { diff --git a/tests/library_checker_aizu_tests/handmade_tests/merge_st_and_wavelet.test.cpp b/tests/library_checker_aizu_tests/handmade_tests/merge_st_and_wavelet.test.cpp index e4afe658..9f25b3cd 100644 --- a/tests/library_checker_aizu_tests/handmade_tests/merge_st_and_wavelet.test.cpp +++ b/tests/library_checker_aizu_tests/handmade_tests/merge_st_and_wavelet.test.cpp @@ -2,8 +2,8 @@ "https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_A" #include "../template.hpp" #include "../../../library/contest/random.hpp" -#include "../../../library/data_structures/seg_tree_uncommon/merge_sort_tree.hpp" -#include "../../../library/data_structures/seg_tree_uncommon/wavelet_matrix.hpp" +#include "../../../library/data_structures_[l,r)/seg_tree_uncommon/merge_sort_tree.hpp" +#include "../../../library/data_structures_[l,r)/seg_tree_uncommon/wavelet_matrix.hpp" int main() { cin.tie(0)->sync_with_stdio(0); // brute force small cases diff --git a/tests/library_checker_aizu_tests/handmade_tests/permutation_tree_small.test.cpp b/tests/library_checker_aizu_tests/handmade_tests/permutation_tree_small.test.cpp index b39e64b8..bbfde4ba 100644 --- a/tests/library_checker_aizu_tests/handmade_tests/permutation_tree_small.test.cpp +++ b/tests/library_checker_aizu_tests/handmade_tests/permutation_tree_small.test.cpp @@ -2,7 +2,7 @@ "https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_A" #include "../template.hpp" #include "../perm_tree_asserts.hpp" -#include "../../../library/data_structures/uncommon/permutation_tree.hpp" +#include "../../../library/data_structures_[l,r)/uncommon/permutation_tree.hpp" int main() { cin.tie(0)->sync_with_stdio(0); for (int n = 1; n <= 8; n++) { diff --git a/tests/library_checker_aizu_tests/handmade_tests/rmq_small_n.test.cpp b/tests/library_checker_aizu_tests/handmade_tests/rmq_small_n.test.cpp index 2dbec0e4..06d1046c 100644 --- a/tests/library_checker_aizu_tests/handmade_tests/rmq_small_n.test.cpp +++ b/tests/library_checker_aizu_tests/handmade_tests/rmq_small_n.test.cpp @@ -2,21 +2,17 @@ "https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_A" #include "../template.hpp" #include "../../../library/contest/random.hpp" -#include "../../../library/data_structures/rmq.hpp" -#include "../../../library/data_structures/uncommon/disjoint_rmq.hpp" -#include "../../../library/data_structures/uncommon/linear_rmq.hpp" +#include "../../../library/data_structures_[l,r)/rmq.hpp" +#include "../../../library/data_structures_[l,r]/linear_rmq.hpp" void test_all_subarrays(const vector& a) { auto n = sz(a); RMQ rmq(a, [](auto x, auto y) { return min(x, y); }); - disjoint_rmq dis_rmq(a, - [](auto x, auto y) { return min(x, y); }); linear_rmq lin_rmq(a, less()); for (int l = 0; l < n; l++) { for (int r = l + 1; r <= n; r++) { int idx_min = lin_rmq.idx(l, r - 1); assert(l <= idx_min && idx_min < r); assert(a[idx_min] == rmq.query(l, r)); - assert(a[idx_min] == dis_rmq.query(l, r)); } } } diff --git a/tests/library_checker_aizu_tests/handmade_tests/seg_tree_find.test.cpp b/tests/library_checker_aizu_tests/handmade_tests/seg_tree_find.test.cpp index 75920096..42248b64 100644 --- a/tests/library_checker_aizu_tests/handmade_tests/seg_tree_find.test.cpp +++ b/tests/library_checker_aizu_tests/handmade_tests/seg_tree_find.test.cpp @@ -2,8 +2,8 @@ "https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_A" #include "../template.hpp" #include "../../../library/contest/random.hpp" -#include "../../../library/data_structures/bit.hpp" -#include "../../../library/data_structures/lazy_seg_tree.hpp" +#include "../../../library/data_structures_[l,r)/bit.hpp" +#include "../../../library/data_structures_[l,r)/lazy_seg_tree.hpp" const int mx_n = 100'000; int rv(int i) { return mx_n - i - 1; } int main() { diff --git a/tests/library_checker_aizu_tests/handmade_tests/seg_tree_find_small.test.cpp b/tests/library_checker_aizu_tests/handmade_tests/seg_tree_find_small.test.cpp index 92d8c688..64b184bf 100644 --- a/tests/library_checker_aizu_tests/handmade_tests/seg_tree_find_small.test.cpp +++ b/tests/library_checker_aizu_tests/handmade_tests/seg_tree_find_small.test.cpp @@ -2,7 +2,7 @@ "https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_A" #include "../template.hpp" #include "../../../library/contest/random.hpp" -#include "../../../library/data_structures/lazy_seg_tree.hpp" +#include "../../../library/data_structures_[l,r)/lazy_seg_tree.hpp" int main() { cin.tie(0)->sync_with_stdio(0); for (int iters = 0; iters < 100; ++iters) { diff --git a/tests/library_checker_aizu_tests/mono_st_asserts.hpp b/tests/library_checker_aizu_tests/mono_st_asserts.hpp index 06ee62a6..c13d6ced 100644 --- a/tests/library_checker_aizu_tests/mono_st_asserts.hpp +++ b/tests/library_checker_aizu_tests/mono_st_asserts.hpp @@ -2,7 +2,7 @@ #include "../../library/monotonic_stack/monotonic_range.hpp" #include "../../library/monotonic_stack/cartesian_binary_tree.hpp" #include "../../library/monotonic_stack/cartesian_k_ary_tree.hpp" -#include "../../library/data_structures/uncommon/linear_rmq.hpp" +#include "../../library/data_structures_[l,r]/linear_rmq.hpp" tuple>, vector> min_cartesian_tree(const vector& a, const vector& l, const vector& r) { diff --git a/tests/library_checker_aizu_tests/perm_tree_asserts.hpp b/tests/library_checker_aizu_tests/perm_tree_asserts.hpp index b1e0e314..7c4ff145 100644 --- a/tests/library_checker_aizu_tests/perm_tree_asserts.hpp +++ b/tests/library_checker_aizu_tests/perm_tree_asserts.hpp @@ -1,6 +1,6 @@ #pragma once -#include "../../library/data_structures/rmq.hpp" -#include "../../library/data_structures/uncommon/permutation_tree.hpp" +#include "../../library/data_structures_[l,r)/rmq.hpp" +#include "../../library/data_structures_[l,r)/uncommon/permutation_tree.hpp" perm_tree perm_tree_asserts(const vector& a) { int n = sz(a); perm_tree pt(a); diff --git a/tests/library_checker_aizu_tests/strings/lcs_queries_merge_sort_tree.test.cpp b/tests/library_checker_aizu_tests/strings/lcs_queries_merge_sort_tree.test.cpp index 5190bea9..e2978baf 100644 --- a/tests/library_checker_aizu_tests/strings/lcs_queries_merge_sort_tree.test.cpp +++ b/tests/library_checker_aizu_tests/strings/lcs_queries_merge_sort_tree.test.cpp @@ -2,7 +2,7 @@ "https://judge.yosupo.jp/problem/prefix_substring_lcs" #include "../template.hpp" #include "../../../library/strings/longest_common_subsequence/lcs_dp.hpp" -#include "../../../library/data_structures/seg_tree_uncommon/merge_sort_tree.hpp" +#include "../../../library/data_structures_[l,r)/seg_tree_uncommon/merge_sort_tree.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int q; diff --git a/tests/library_checker_aizu_tests/trees/hld_aizu1.test.cpp b/tests/library_checker_aizu_tests/trees/hld_aizu1.test.cpp index 00287f91..5464c19c 100644 --- a/tests/library_checker_aizu_tests/trees/hld_aizu1.test.cpp +++ b/tests/library_checker_aizu_tests/trees/hld_aizu1.test.cpp @@ -2,7 +2,7 @@ "https://onlinejudge.u-aizu.ac.jp/problems/GRL_5_D" #include "../template.hpp" #include "../../../library/trees/hld.hpp" -#include "../../../library/data_structures/bit.hpp" +#include "../../../library/data_structures_[l,r)/bit.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n; diff --git a/tests/library_checker_aizu_tests/trees/hld_aizu2.test.cpp b/tests/library_checker_aizu_tests/trees/hld_aizu2.test.cpp index aaa4df24..39210bb5 100644 --- a/tests/library_checker_aizu_tests/trees/hld_aizu2.test.cpp +++ b/tests/library_checker_aizu_tests/trees/hld_aizu2.test.cpp @@ -2,7 +2,7 @@ "https://onlinejudge.u-aizu.ac.jp/problems/GRL_5_E" #include "../template.hpp" #include "../../../library/trees/hld.hpp" -#include "../../../library/data_structures/lazy_seg_tree.hpp" +#include "../../../library/data_structures_[l,r)/lazy_seg_tree.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n; diff --git a/tests/library_checker_aizu_tests/trees/hld_lib_checker_path.test.cpp b/tests/library_checker_aizu_tests/trees/hld_lib_checker_path.test.cpp index 962c4d77..f72ec13b 100644 --- a/tests/library_checker_aizu_tests/trees/hld_lib_checker_path.test.cpp +++ b/tests/library_checker_aizu_tests/trees/hld_lib_checker_path.test.cpp @@ -2,7 +2,7 @@ "https://judge.yosupo.jp/problem/vertex_add_path_sum" #include "../template.hpp" #include "../../../library/trees/hld.hpp" -#include "../../../library/data_structures/bit.hpp" +#include "../../../library/data_structures_[l,r)/bit.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, q; diff --git a/tests/library_checker_aizu_tests/trees/hld_lib_checker_subtree_edges.test.cpp b/tests/library_checker_aizu_tests/trees/hld_lib_checker_subtree_edges.test.cpp index 24c2f981..b661d484 100644 --- a/tests/library_checker_aizu_tests/trees/hld_lib_checker_subtree_edges.test.cpp +++ b/tests/library_checker_aizu_tests/trees/hld_lib_checker_subtree_edges.test.cpp @@ -2,7 +2,7 @@ "https://judge.yosupo.jp/problem/vertex_add_subtree_sum" #include "../template.hpp" #include "../../../library/trees/hld.hpp" -#include "../../../library/data_structures/bit.hpp" +#include "../../../library/data_structures_[l,r)/bit.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, q; diff --git a/tests/library_checker_aizu_tests/trees/hld_lib_checker_subtree_nodes.test.cpp b/tests/library_checker_aizu_tests/trees/hld_lib_checker_subtree_nodes.test.cpp index 78146446..88cc0e3e 100644 --- a/tests/library_checker_aizu_tests/trees/hld_lib_checker_subtree_nodes.test.cpp +++ b/tests/library_checker_aizu_tests/trees/hld_lib_checker_subtree_nodes.test.cpp @@ -2,7 +2,7 @@ "https://judge.yosupo.jp/problem/vertex_add_subtree_sum" #include "../template.hpp" #include "../../../library/trees/hld.hpp" -#include "../../../library/data_structures/bit.hpp" +#include "../../../library/data_structures_[l,r)/bit.hpp" int main() { cin.tie(0)->sync_with_stdio(0); int n, q; diff --git a/tests/scripts/build_pdf.sh b/tests/scripts/build_pdf.sh index 192f3ce7..e2cd8bbd 100755 --- a/tests/scripts/build_pdf.sh +++ b/tests/scripts/build_pdf.sh @@ -10,15 +10,15 @@ echo "DON'T PUSH ANY OF THESE CHANGES TO THE REPO!!!!!!!!" echo "if you push these changes, I'll slap your butt" # remove some files not suitable for PDF: -rm ../library/data_structures/bit_uncommon/rupq.hpp || exit 1 -rm ../library/data_structures/bit_uncommon/rurq.hpp || exit 1 -rm ../library/data_structures/seg_tree.png || exit 1 -rm ../library/data_structures/seg_tree_uncommon/distinct_query.hpp || exit 1 -rm ../library/data_structures/seg_tree_uncommon/implicit.hpp || exit 1 -rm ../library/data_structures/seg_tree_uncommon/kth_smallest_query.hpp || exit 1 -rm ../library/data_structures/uncommon/mode_query.hpp || exit 1 -rm ../library/data_structures/uncommon/priority_queue_of_updates.hpp || exit 1 -rm ../library/data_structures/uncommon/deque_op.hpp || exit 1 +rm "../library/data_structures_[l,r)/bit_uncommon/rupq.hpp" || exit 1 +rm "../library/data_structures_[l,r)/bit_uncommon/rurq.hpp" || exit 1 +rm "../library/data_structures_[l,r)/uncommon/seg_tree.png" || exit 1 +rm "../library/data_structures_[l,r)/seg_tree_uncommon/distinct_query.hpp" || exit 1 +rm "../library/data_structures_[l,r)/seg_tree_uncommon/implicit.hpp" || exit 1 +rm "../library/data_structures_[l,r)/seg_tree_uncommon/kth_smallest_query.hpp" || exit 1 +rm "../library/data_structures_[l,r)/uncommon/mode_query.hpp" || exit 1 +rm "../library/data_structures_[l,r)/uncommon/priority_queue_of_updates.hpp" || exit 1 +rm "../library/data_structures_[l,r)/uncommon/deque_op.hpp" || exit 1 rm ../library/graphs/strongly_connected_components/add_edges_strongly_connected.hpp || exit 1 rm ../library/graphs/strongly_connected_components/offline_incremental_scc.hpp || exit 1 rm ../library/graphs/uncommon/bridges.hpp || exit 1 @@ -58,7 +58,10 @@ cat ../library/**/*.hpp | echo "check no multiline comments. Generating hashes of file-prefixes requires this." grep --extended-regexp "\/\*" --recursive ../library/**/*.hpp && exit 1 -make compile_commented_snippets || exit 1 +find ../library/ -path "../library/data_structures_\[l,r\]" -prune -o -type f -name "*.hpp" -print | ./scripts/compile_commented_snippets.sh || exit 1 +rm entire_library_without_main || exit 1 +rm entire_library.cpp || exit 1 +find "../library/data_structures_[l,r]" -type f -name "*.hpp" | ./scripts/compile_commented_snippets.sh || exit 1 # remove #pragma once sed --in-place '/^#pragma once$/d' ../library/**/*.hpp diff --git a/tests/scripts/compile_commented_snippets.sh b/tests/scripts/compile_commented_snippets.sh index 2c0cb93d..7d8f1023 100755 --- a/tests/scripts/compile_commented_snippets.sh +++ b/tests/scripts/compile_commented_snippets.sh @@ -5,7 +5,9 @@ shopt -s globstar git submodule init git submodule update -# build cpp file with everything in the library with all code in @code ... +# Intended usage: +# find ../library/ -type f -name "*.hpp" | ./scripts/compile_commented_snippets.sh +# build cpp file with all files passed in via stdin and with all code in @code ... # @endcode comments in main { @@ -13,10 +15,10 @@ git submodule update echo "using namespace std;" cat library_checker_aizu_tests/kactl_macros.hpp echo "const ll mod = (119 << 23) + 1, root = 62;" - find ../library/ -type f -name "*.hpp" | grep --invert-match --file=.config/.code_snippet_excluded_file_list | sort | sed 's/^/#include "/; s/$/"/' | cpp -nostdinc -C -P | grep --invert-match --extended-regexp "const int mod = |const ll mod = " + cat | grep --invert-match --file=.config/.code_snippet_excluded_file_list | sort | sed 's/^/#include "/; s/$/"/' | cpp -nostdinc -C -P | grep --invert-match --extended-regexp "const int mod = |const ll mod = " echo "int main() {" echo "vi a,b,subset;" - echo "vl left,bottom;" + echo "vector left,bottom;" echo "vector edges;" echo "vector> eds;" echo "vector> w_eds, queries;"