Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ runs:
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 22
sudo apt-get update
sudo apt-get install -y clang-format-22 clang-tidy-22
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
clang-22 --version
clang-format-22 --version
clang-tidy-22 --version
g++ --version
14 changes: 11 additions & 3 deletions .github/workflows/programming_team_code_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ jobs:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
- name: Make preinstalled g++-14 the default g++
run: |
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
g++ --version
- name: Install dependencies
run: |
pip install "setuptools<81"
Expand Down Expand Up @@ -53,6 +57,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Make preinstalled g++-14 the default g++
run: |
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100
g++ --version
- name: g++ with gcc
run: make --directory=tests/ compile_gcc

Expand All @@ -76,8 +84,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Install texlive, rename, nodejs, npm
run: sudo apt install texlive texlive-latex-extra rename nodejs npm
- name: Install texlive, rename
run: sudo apt install texlive texlive-latex-extra rename
- name: build pdf
run: make --directory=tests/ build_pdf
- uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -127,6 +135,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt install shfmt shellcheck
run: sudo apt install shfmt
- name: shellcheck, shfmt
run: make --directory=tests/ shellcheck_shfmt
2 changes: 1 addition & 1 deletion .verify-helper/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
CXX = "g++"
CXXFLAGS = [
"-O2",
"-std=c++20",
"-std=c++23",
"-fsanitize=address,undefined",
"-fno-sanitize-recover=all",
"-fstack-protector",
Expand Down
30 changes: 15 additions & 15 deletions .verify-helper/timestamps.remote.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"tests/library_checker_aizu_tests/data_structures/lazy_segment_tree_inc_constructor.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/data_structures/merge_sort_tree.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/data_structures/mode_query.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/data_structures/permutation_tree.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/data_structures/permutation_tree.test.cpp": "2026-07-06 22:18:09 -0700",
"tests/library_checker_aizu_tests/data_structures/persistent_queue_tree.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/data_structures/persistent_seg_tree.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/data_structures/pq_ds_undo_sliding_window.test.cpp": "2026-07-06 13:10:16 -0700",
Expand All @@ -49,7 +49,7 @@
"tests/library_checker_aizu_tests/dsu/dsu_bipartite.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/dsu/dsu_weighted_aizu.test.cpp": "2026-07-06 13:49:19 -0700",
"tests/library_checker_aizu_tests/dsu/dsu_weighted_lib_checker.test.cpp": "2026-07-06 13:49:19 -0700",
"tests/library_checker_aizu_tests/dsu/kruskal_tree_aizu.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/dsu/kruskal_tree_aizu.test.cpp": "2026-07-06 22:18:09 -0700",
"tests/library_checker_aizu_tests/dsu/line_tree_aizu.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/dsu/line_tree_lib_checker.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/dsu/range_parallel_dsu.test.cpp": "2026-07-06 13:10:16 -0700",
Expand All @@ -62,7 +62,7 @@
"tests/library_checker_aizu_tests/graphs/biconnected_components.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/graphs/connected_components_of_complement_graph.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/graphs/dijkstra_aizu.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/graphs/dijkstra_lib_checker.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/graphs/dijkstra_lib_checker.test.cpp": "2026-07-06 22:18:09 -0700",
"tests/library_checker_aizu_tests/graphs/directed_cycle.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/graphs/enumerate_triangles.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/graphs/euler_walk_directed.test.cpp": "2026-07-06 13:10:16 -0700",
Expand All @@ -74,11 +74,11 @@
"tests/library_checker_aizu_tests/graphs/strongly_connected_components_aizu.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/graphs/strongly_connected_components_lib_checker.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/graphs/two_edge_components.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/handmade_tests/count_paths.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/handmade_tests/dsu.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/handmade_tests/edge_cd_small_trees.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/handmade_tests/count_paths.test.cpp": "2026-07-06 22:18:09 -0700",
"tests/library_checker_aizu_tests/handmade_tests/dsu.test.cpp": "2026-07-06 22:18:09 -0700",
"tests/library_checker_aizu_tests/handmade_tests/edge_cd_small_trees.test.cpp": "2026-07-06 22:18:09 -0700",
"tests/library_checker_aizu_tests/handmade_tests/fib_matrix_expo.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/handmade_tests/functional_graph.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/handmade_tests/functional_graph.test.cpp": "2026-07-06 22:43:37 -0700",
"tests/library_checker_aizu_tests/handmade_tests/hilbert_mos.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/handmade_tests/kd_bit.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/handmade_tests/kth_par.test.cpp": "2026-07-06 13:10:16 -0700",
Expand All @@ -92,7 +92,7 @@
"tests/library_checker_aizu_tests/handmade_tests/sa_find_subarray.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/handmade_tests/seg_tree_find.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/handmade_tests/seg_tree_find_small.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/handmade_tests/seg_tree_midpoint.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/handmade_tests/seg_tree_midpoint.test.cpp": "2026-07-06 22:18:09 -0700",
"tests/library_checker_aizu_tests/handmade_tests/xor_basis_walk.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/loops/chooses.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/loops/quotients.test.cpp": "2026-07-06 13:10:16 -0700",
Expand Down Expand Up @@ -132,11 +132,11 @@
"tests/library_checker_aizu_tests/strings/suffix_array_short.test.cpp": "2026-04-12 06:15:25 -0600",
"tests/library_checker_aizu_tests/strings/trie.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/strings/wildcard_pattern_matching.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/trees/cd_count_paths_per_length.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_query.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_update.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/trees/edge_cd_count_paths_per_length.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/trees/edge_cd_reroot_dp.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/trees/cd_count_paths_per_length.test.cpp": "2026-07-06 22:18:09 -0700",
"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_query.test.cpp": "2026-07-06 22:43:37 -0700",
"tests/library_checker_aizu_tests/trees/edge_cd_contour_range_update.test.cpp": "2026-07-06 22:43:37 -0700",
"tests/library_checker_aizu_tests/trees/edge_cd_count_paths_per_length.test.cpp": "2026-07-06 22:18:09 -0700",
"tests/library_checker_aizu_tests/trees/edge_cd_reroot_dp.test.cpp": "2026-07-06 22:18:09 -0700",
"tests/library_checker_aizu_tests/trees/hld_aizu1.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/trees/hld_aizu2.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/trees/hld_lib_checker_path.test.cpp": "2026-07-06 13:10:16 -0700",
Expand All @@ -148,7 +148,7 @@
"tests/library_checker_aizu_tests/trees/kth_path_tree_lift.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/trees/lca_all_methods_aizu.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/trees/lca_all_methods_lib_checker.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/trees/shallowest_aizu_tree_height.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/trees/shallowest_lib_checker_tree_path_composite.test.cpp": "2026-07-06 13:10:16 -0700",
"tests/library_checker_aizu_tests/trees/shallowest_aizu_tree_height.test.cpp": "2026-07-06 22:18:09 -0700",
"tests/library_checker_aizu_tests/trees/shallowest_lib_checker_tree_path_composite.test.cpp": "2026-07-06 22:18:09 -0700",
"tests/library_checker_aizu_tests/trees/subtree_isomorphism.test.cpp": "2026-07-06 13:10:16 -0700"
}
2 changes: 1 addition & 1 deletion tests/.config/.clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,5 @@ SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: c++20
Standard: Latest
...
2 changes: 1 addition & 1 deletion tests/.config/.gcc_compile_flags
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
-Wduplicated-cond
-Werror
-O2
-std=c++20
-std=c++23
4 changes: 2 additions & 2 deletions tests/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
help:
@echo "command | explanation"
@echo "------------------------------------ | -----------"
@echo "make compile_gcc | compile all tests with -std=c++20 for warnings"
@echo "make compile_gcc | compile all tests with -std=c++23 for warnings"
@echo " |"
@echo "make compile_clang | compile all tests with clang, -std=c++20 for warnings"
@echo "make compile_clang | compile all tests with clang, -std=c++23 for warnings"
@echo " |"
@echo "make grep_clangformat_cppcheck | various greps to catch certain things, clang-format, cppcheck"
@echo " |"
Expand Down
8 changes: 4 additions & 4 deletions tests/library_checker_aizu_tests/cd_asserts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ void cd_asserts(vector<vi> adj) {
vi naive_par_decomp(sz(adj), -1);
vi par = cd(adj, [&](int cent) -> void {
assert(decomp_size[cent] == -1);
auto dfs = [&](auto&& self, int u, int p) -> int {
auto dfs = [&](this auto&& self, int u, int p) -> int {
if (p != -1) naive_par_decomp[u] = cent;
int sub_size = 1;
for (int v : adj[u])
if (v != p) sub_size += self(self, v, u);
if (v != p) sub_size += self(v, u);
return sub_size;
};
decomp_size[cent] = dfs(dfs, cent, -1);
decomp_size[cent] = dfs(cent, -1);
for (int u : adj[cent]) {
int sz_subtree = dfs(dfs, u, cent);
int sz_subtree = dfs(u, cent);
assert(1 <= sz_subtree &&
2 * sz_subtree <= decomp_size[cent]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ int main() {
cout << sz(ch) << '\n';
int curr_time = 0;
vi node_to_time(sz(ch), -1);
auto dfs = [&](auto&& self, int u, int p) -> void {
auto dfs = [&](this auto&& self, int u, int p) -> void {
node_to_time[u] = curr_time++;
cout << (p == -1 ? p : node_to_time[p]) << " "
<< pt.p[u].mn_idx << " "
<< pt.p[u].mn_idx + pt.p[u].len - 1 << " "
<< (pt.p[u].is_join || empty(ch[u]) ? "linear"
: "prime")
<< '\n';
for (int v : ch[u]) self(self, v, u);
for (int v : ch[u]) self(v, u);
};
dfs(dfs, root, -1);
dfs(root, -1);
return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ int main() {
rep(i, n, kt.id) mst_sum += weight[i];
vi depth(2 * n);
vi actual_par(2 * n, -1);
auto dfs = [&](auto&& self, int v) -> void {
auto dfs = [&](this auto&& self, int v) -> void {
for (int u : kt.g[v]) {
depth[u] = 1 + depth[v];
actual_par[u] = v;
self(self, u);
self(u);
}
};
dfs(dfs, kt.id - 1);
dfs(kt.id - 1);
rep(i, 0, n) rep(j, i + 1, n) {
int u = i, v = j;
while (u != v)
Expand Down
8 changes: 4 additions & 4 deletions tests/library_checker_aizu_tests/edge_cd_asserts.hpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#pragma once
auto edge_cd_asserts = [&](int cent, int split) -> void {
assert(0 < split && split < sz(adj[cent]));
auto dfs = [&](auto&& self, int u, int p) -> int {
auto dfs = [&](this auto&& self, int u, int p) -> int {
int siz = 1;
for (int v : adj[u])
if (v != p) siz += self(self, v, u);
if (v != p) siz += self(v, u);
return siz;
};
int sz_all = dfs(dfs, cent, -1);
int sz_all = dfs(cent, -1);
assert(sz_all >= 3);
array<int, 2> cnts = {0, 0};
array<int, 2> max_cnt = {0, 0};
array<int, 2> number_of_cnts = {0, 0};
rep(i, 0, sz(adj[cent])) {
int sz_subtree = dfs(dfs, adj[cent][i], cent);
int sz_subtree = dfs(adj[cent][i], cent);
assert(2 * sz_subtree <= sz_all);
cnts[i < split] += sz_subtree;
max_cnt[i < split] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@ int main() {
vector<bool> vis(n);
vis[t] = 1;
vector<array<int, 2>> path;
auto dfs = [&](auto&& self, int u) -> bool {
auto dfs = [&](this auto&& self, int u) -> bool {
if (u == s) return 1;
for (auto [v, w] : adj_inv[u]) {
if (!vis[v] && len[v] != LLONG_MAX &&
len[v] + w == len[u]) {
vis[v] = 1;
if (self(self, v)) {
if (self(v)) {
path.push_back({v, u});
return 1;
}
}
}
return 0;
};
assert(dfs(dfs, t));
assert(dfs(t));
cout << len[t] << " " << sz(path) << '\n';
for (auto [u, v] : path) cout << u << " " << v << '\n';
return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ vector<ll> count_paths_per_node(vector<vi> adj, int k) {
vector<ll> num_paths(sz(adj));
cd(adj, [&](int cent) {
vector pre_d{1}, cur_d{0};
auto dfs = [&](auto&& self, int u, int p,
auto dfs = [&](this auto&& self, int u, int p,
int d) -> ll {
if (d > k) return 0LL;
if (sz(cur_d) <= d) cur_d.push_back(0);
cur_d[d]++;
ll cnt = 0;
if (k - d < sz(pre_d)) cnt += pre_d[k - d];
for (int c : adj[u])
if (c != p) cnt += self(self, c, u, d + 1);
if (c != p) cnt += self(c, u, d + 1);
num_paths[u] += cnt;
return cnt;
};
auto dfs_child = [&](int child) -> ll {
ll cnt = dfs(dfs, child, cent, 1);
ll cnt = dfs(child, cent, 1);
pre_d.resize(sz(cur_d));
for (int i = 1; i < sz(cur_d) && cur_d[i]; i++)
pre_d[i] += cur_d[i], cur_d[i] = 0;
Expand Down Expand Up @@ -72,15 +72,15 @@ vector<ll> count_paths_per_length(vector<vi> adj) {
if (sz(adj) >= 2) num_paths[1] = sz(adj) - 1;
edge_cd(adj, [&](int cent, int split) {
vector<vector<double>> cnt(2, vector<double>(1));
auto dfs = [&](auto&& self, int u, int p, int d,
auto dfs = [&](this auto&& self, int u, int p, int d,
int side) -> void {
if (sz(cnt[side]) == d) cnt[side].push_back(0.0);
cnt[side][d]++;
for (int c : adj[u])
if (c != p) self(self, c, u, 1 + d, side);
if (c != p) self(c, u, 1 + d, side);
};
rep(i, 0, sz(adj[cent]))
dfs(dfs, adj[cent][i], cent, 1, i < split);
dfs(adj[cent][i], cent, 1, i < split);
vector<double> prod = conv(cnt[0], cnt[1]);
rep(i, 0, sz(prod)) num_paths[i] += llround(prod[i]);
});
Expand Down
12 changes: 6 additions & 6 deletions tests/library_checker_aizu_tests/handmade_tests/dsu.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,34 @@ int main() {
bool joined = dsu.join(u, v);
{
vector<bool> vis(n);
auto dfs = [&](auto&& self, int v) -> void {
auto dfs = [&](this auto&& self, int v) -> void {
for (int u : adj[v]) {
if (!vis[u]) {
vis[u] = 1;
self(self, u);
self(u);
}
}
};
vis[u] = 1;
dfs(dfs, u);
dfs(u);
assert(vis[v] != joined);
}
adj[u].push_back(v);
adj[v].push_back(u);
rep(i, 0, n) {
vector<bool> vis(n);
int cnt_nodes = 0;
auto dfs = [&](auto&& self, int v) -> void {
auto dfs = [&](this auto&& self, int v) -> void {
cnt_nodes++;
for (int u : adj[v]) {
if (!vis[u]) {
vis[u] = 1;
self(self, u);
self(u);
}
}
};
vis[i] = 1;
dfs(dfs, i);
dfs(i);
assert(cnt_nodes == dsu.size(i));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ int lg(int x) { return bit_width(x + 0u) - 1; }
int main() {
cin.tie(0)->sync_with_stdio(0);
rep(n, 1, 5000) {
auto dfs = [&](auto&& self, int tl, int tr,
auto dfs = [&](this auto&& self, int tl, int tr,
int v) -> void {
assert((v >= n) == ((tr - tl) == 1));
if (v >= n) { // leaf node
Expand Down Expand Up @@ -58,11 +58,11 @@ int main() {
assert(split(tl - 1234, tr - 1234) == tm - 1234);
assert(split(tl - 1, tr - 1) == tm - 1);
assert(split(tl + 50, tr + 50) == tm + 50);
self(self, tl, tm, 2 * v);
self(self, tm, tr, 2 * v + 1);
self(tl, tm, 2 * v);
self(tm, tr, 2 * v + 1);
}
};
dfs(dfs, 0, n, 1);
dfs(0, n, 1);
}
cout << "Hello World\n";
return 0;
Expand Down
Loading
Loading