From 9ebda8782354e171cd006f5f531589afea1f5900 Mon Sep 17 00:00:00 2001 From: ei1333 Date: Mon, 10 Aug 2026 10:40:04 +0000 Subject: [PATCH 01/16] Migrate AOJ DPL verification tests --- SELF_CONTAINED_HEADER_MIGRATION.md | 5 +++-- scripts/verify-template-include-allowlist.txt | 7 ------- test/verify/aoj-dpl-1-b.test.cpp | 14 +++++++++----- test/verify/aoj-dpl-1-c.test.cpp | 14 +++++++++----- test/verify/aoj-dpl-1-d.test.cpp | 13 ++++++++----- test/verify/aoj-dpl-1-e.test.cpp | 12 +++++++----- test/verify/aoj-dpl-1-f.test.cpp | 13 ++++++++----- test/verify/aoj-dpl-1-i.test.cpp | 19 +++++++++++-------- test/verify/aoj-dpl-3-c.test.cpp | 13 ++++++++----- 9 files changed, 63 insertions(+), 47 deletions(-) diff --git a/SELF_CONTAINED_HEADER_MIGRATION.md b/SELF_CONTAINED_HEADER_MIGRATION.md index 35ccc9511..e070f5a1c 100644 --- a/SELF_CONTAINED_HEADER_MIGRATION.md +++ b/SELF_CONTAINED_HEADER_MIGRATION.md @@ -27,7 +27,7 @@ import と別名を意図的に提供する集約ヘッダーのため、自己 | ----------------------------------------- | -------- | ---- | | リポジトリ内の `.hpp` | 調査済み | 320 | | 自己完結化して継続検査しているヘッダー | 移行済み | 319 | -| `template/template.hpp` に依存する verify | 移行待ち | 243 | +| `template/template.hpp` に依存する verify | 移行待ち | 236 | 移行済みヘッダーの正本は [`scripts/self-contained-headers.txt`](scripts/self-contained-headers.txt)、 @@ -55,7 +55,7 @@ import と別名を意図的に提供する集約ヘッダーのため、自己 ### 3. 対応する verify を移行する -状態: 未着手 +状態: 進行中 依存先ヘッダーが自己完結した後、対応する verify から `template/template.hpp` を削除する。必要な標準ヘッダー、型別名、入出力処理、 @@ -143,6 +143,7 @@ g++ -std=c++17 -fsyntax-only -x c++ -include ./path/to/header.hpp /dev/null | 2026-08-10 | `geometry/template.hpp`、`graph/flow/` の10ヘッダー、`graph/mst/` の1ヘッダー、`graph/others/` の2ヘッダー | 標準 include と `std::` 修飾 | | 2026-08-10 | `structure/bbst/` の10ヘッダー、`structure/dynamic-tree/` の13ヘッダー、`structure/wavelet/` の2ヘッダー | 標準 include と `std::` 修飾 | | 2026-08-10 | 移行済みヘッダー34件 | 未修飾標準名と include guard を修正 | +| 2026-08-10 | AOJ DPL の verify 7件 | テンプレート依存を削除 | ## 次の候補 diff --git a/scripts/verify-template-include-allowlist.txt b/scripts/verify-template-include-allowlist.txt index 08cd59f4f..fa493ee85 100644 --- a/scripts/verify-template-include-allowlist.txt +++ b/scripts/verify-template-include-allowlist.txt @@ -55,13 +55,6 @@ test/verify/aoj-cgl-4-c.test.cpp test/verify/aoj-cgl-7-d.test.cpp test/verify/aoj-cgl-7-e.test.cpp test/verify/aoj-cgl-7-h.test.cpp -test/verify/aoj-dpl-1-b.test.cpp -test/verify/aoj-dpl-1-c.test.cpp -test/verify/aoj-dpl-1-d.test.cpp -test/verify/aoj-dpl-1-e.test.cpp -test/verify/aoj-dpl-1-f.test.cpp -test/verify/aoj-dpl-1-i.test.cpp -test/verify/aoj-dpl-3-c.test.cpp test/verify/aoj-dpl-5-g.test.cpp test/verify/aoj-dpl-5-i.test.cpp test/verify/aoj-dpl-5-j.test.cpp diff --git a/test/verify/aoj-dpl-1-b.test.cpp b/test/verify/aoj-dpl-1-b.test.cpp index 8aea5fef2..aea373ac4 100644 --- a/test/verify/aoj-dpl-1-b.test.cpp +++ b/test/verify/aoj-dpl-1-b.test.cpp @@ -1,14 +1,18 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_B +// clang-format on -#include "../../template/template.hpp" +#include +#include +#include #include "../../dp/knapsack-01.hpp" int main() { int N, W; - cin >> N >> W; - vector< int > v(N), w(N); - for(int i = 0; i < N; i++) cin >> v[i] >> w[i]; + std::cin >> N >> W; + std::vector v(N), w(N); + for (int i = 0; i < N; i++) std::cin >> v[i] >> w[i]; auto ret = knapsack_01(w, v, W, -1); - cout << *max_element(begin(ret), end(ret)) << endl; + std::cout << *std::max_element(ret.begin(), ret.end()) << std::endl; } diff --git a/test/verify/aoj-dpl-1-c.test.cpp b/test/verify/aoj-dpl-1-c.test.cpp index 0ccc7e434..05b3ce630 100644 --- a/test/verify/aoj-dpl-1-c.test.cpp +++ b/test/verify/aoj-dpl-1-c.test.cpp @@ -1,14 +1,18 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_C +// clang-format on -#include "../../template/template.hpp" +#include +#include +#include #include "../../dp/knapsack.hpp" int main() { int N, W; - cin >> N >> W; - vector< int > v(N), w(N); - for(int i = 0; i < N; i++) cin >> v[i] >> w[i]; + std::cin >> N >> W; + std::vector v(N), w(N); + for (int i = 0; i < N; i++) std::cin >> v[i] >> w[i]; auto ret = knapsack(w, v, W, -1); - cout << *max_element(begin(ret), end(ret)) << endl; + std::cout << *std::max_element(ret.begin(), ret.end()) << std::endl; } diff --git a/test/verify/aoj-dpl-1-d.test.cpp b/test/verify/aoj-dpl-1-d.test.cpp index 6322de131..d9ee70289 100644 --- a/test/verify/aoj-dpl-1-d.test.cpp +++ b/test/verify/aoj-dpl-1-d.test.cpp @@ -1,13 +1,16 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_D +// clang-format on -#include "../../template/template.hpp" +#include +#include #include "../../dp/longest-increasing-subsequence.hpp" int main() { int N; - cin >> N; - vector< int > A(N); - cin >> A; - cout << longest_increasing_subsequence(A, true) << endl; + std::cin >> N; + std::vector A(N); + for (int& a : A) std::cin >> a; + std::cout << longest_increasing_subsequence(A, true) << std::endl; } diff --git a/test/verify/aoj-dpl-1-e.test.cpp b/test/verify/aoj-dpl-1-e.test.cpp index 15175cba3..7186e7d32 100644 --- a/test/verify/aoj-dpl-1-e.test.cpp +++ b/test/verify/aoj-dpl-1-e.test.cpp @@ -1,12 +1,14 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_E +// clang-format on -#include "../../template/template.hpp" +#include +#include #include "../../dp/edit-distance.hpp" int main() { - string S, T; - cin >> S >> T; - cout << edit_distance(S, T) << endl; + std::string S, T; + std::cin >> S >> T; + std::cout << edit_distance(S, T) << std::endl; } - diff --git a/test/verify/aoj-dpl-1-f.test.cpp b/test/verify/aoj-dpl-1-f.test.cpp index 87c6cc446..f2b1bdff0 100644 --- a/test/verify/aoj-dpl-1-f.test.cpp +++ b/test/verify/aoj-dpl-1-f.test.cpp @@ -1,13 +1,16 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_F +// clang-format on -#include "../../template/template.hpp" +#include +#include #include "../../dp/knapsack-01-2.hpp" int main() { int N, W; - cin >> N >> W; - vector< int > v(N), w(N); - for(int i = 0; i < N; i++) cin >> v[i] >> w[i]; - cout << knapsack_01_2(w, v, W) << endl; + std::cin >> N >> W; + std::vector v(N), w(N); + for (int i = 0; i < N; i++) std::cin >> v[i] >> w[i]; + std::cout << knapsack_01_2(w, v, W) << std::endl; } diff --git a/test/verify/aoj-dpl-1-i.test.cpp b/test/verify/aoj-dpl-1-i.test.cpp index 223b4712c..4eb9ec9c4 100644 --- a/test/verify/aoj-dpl-1-i.test.cpp +++ b/test/verify/aoj-dpl-1-i.test.cpp @@ -1,17 +1,20 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_I +// clang-format on -#include "../../template/template.hpp" +#include +#include #include "../../dp/knapsack-limitations-2.hpp" int main() { int N; - int64 W; - cin >> N >> W; - vector< int > v(N); - vector< int64 > w(N), m(N); - for(int i = 0; i < N; i++) { - cin >> v[i] >> w[i] >> m[i]; + long long W; + std::cin >> N >> W; + std::vector v(N); + std::vector w(N), m(N); + for (int i = 0; i < N; i++) { + std::cin >> v[i] >> w[i] >> m[i]; } - cout << knapsack_limitations(w, m, v, W) << endl; + std::cout << knapsack_limitations(w, m, v, W) << std::endl; } diff --git a/test/verify/aoj-dpl-3-c.test.cpp b/test/verify/aoj-dpl-3-c.test.cpp index 1c43f55db..c1a2ca370 100644 --- a/test/verify/aoj-dpl-3-c.test.cpp +++ b/test/verify/aoj-dpl-3-c.test.cpp @@ -1,13 +1,16 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_3_C +// clang-format on -#include "../../template/template.hpp" +#include +#include #include "../../dp/largest-rectangle.hpp" int main() { int N; - cin >> N; - vector< int > h(N); - cin >> h; - cout << largest_rectangle(h) << endl; + std::cin >> N; + std::vector h(N); + for (int& height : h) std::cin >> height; + std::cout << largest_rectangle(h) << std::endl; } From 69724deefb346d75ec92f9ee115aa454e12324d3 Mon Sep 17 00:00:00 2001 From: ei1333 Date: Mon, 10 Aug 2026 10:41:56 +0000 Subject: [PATCH 02/16] Migrate AOJ combinatorics verification tests --- SELF_CONTAINED_HEADER_MIGRATION.md | 3 ++- scripts/verify-template-include-allowlist.txt | 3 --- test/verify/aoj-dpl-5-g.test.cpp | 11 ++++++----- test/verify/aoj-dpl-5-i.test.cpp | 10 +++++----- test/verify/aoj-dpl-5-j.test.cpp | 9 +++++---- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/SELF_CONTAINED_HEADER_MIGRATION.md b/SELF_CONTAINED_HEADER_MIGRATION.md index e070f5a1c..8559b44be 100644 --- a/SELF_CONTAINED_HEADER_MIGRATION.md +++ b/SELF_CONTAINED_HEADER_MIGRATION.md @@ -27,7 +27,7 @@ import と別名を意図的に提供する集約ヘッダーのため、自己 | ----------------------------------------- | -------- | ---- | | リポジトリ内の `.hpp` | 調査済み | 320 | | 自己完結化して継続検査しているヘッダー | 移行済み | 319 | -| `template/template.hpp` に依存する verify | 移行待ち | 236 | +| `template/template.hpp` に依存する verify | 移行待ち | 233 | 移行済みヘッダーの正本は [`scripts/self-contained-headers.txt`](scripts/self-contained-headers.txt)、 @@ -144,6 +144,7 @@ g++ -std=c++17 -fsyntax-only -x c++ -include ./path/to/header.hpp /dev/null | 2026-08-10 | `structure/bbst/` の10ヘッダー、`structure/dynamic-tree/` の13ヘッダー、`structure/wavelet/` の2ヘッダー | 標準 include と `std::` 修飾 | | 2026-08-10 | 移行済みヘッダー34件 | 未修飾標準名と include guard を修正 | | 2026-08-10 | AOJ DPL の verify 7件 | テンプレート依存を削除 | +| 2026-08-10 | AOJ DPL の組合せ verify 3件 | テンプレート依存を削除 | ## 次の候補 diff --git a/scripts/verify-template-include-allowlist.txt b/scripts/verify-template-include-allowlist.txt index fa493ee85..57f06859c 100644 --- a/scripts/verify-template-include-allowlist.txt +++ b/scripts/verify-template-include-allowlist.txt @@ -55,9 +55,6 @@ test/verify/aoj-cgl-4-c.test.cpp test/verify/aoj-cgl-7-d.test.cpp test/verify/aoj-cgl-7-e.test.cpp test/verify/aoj-cgl-7-h.test.cpp -test/verify/aoj-dpl-5-g.test.cpp -test/verify/aoj-dpl-5-i.test.cpp -test/verify/aoj-dpl-5-j.test.cpp test/verify/aoj-dsl-1-a.test.cpp test/verify/aoj-dsl-1-b.test.cpp test/verify/aoj-dsl-2-a.test.cpp diff --git a/test/verify/aoj-dpl-5-g.test.cpp b/test/verify/aoj-dpl-5-g.test.cpp index 05995d2f9..f3a7f6ac0 100644 --- a/test/verify/aoj-dpl-5-g.test.cpp +++ b/test/verify/aoj-dpl-5-g.test.cpp @@ -1,13 +1,14 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_5_G +// clang-format on -#include "../../template/template.hpp" - -#include "../../math/combinatorics/montgomery-mod-int.hpp" +#include #include "../../math/combinatorics/bell-number.hpp" +#include "../../math/combinatorics/montgomery-mod-int.hpp" int main() { int N, K; - cin >> N >> K; - cout << bell_number< modint1000000007 >(N, K) << endl; + std::cin >> N >> K; + std::cout << bell_number(N, K) << std::endl; } diff --git a/test/verify/aoj-dpl-5-i.test.cpp b/test/verify/aoj-dpl-5-i.test.cpp index a3edc5ea0..f39d31db2 100644 --- a/test/verify/aoj-dpl-5-i.test.cpp +++ b/test/verify/aoj-dpl-5-i.test.cpp @@ -1,14 +1,14 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_5_I +// clang-format on -#include "../../template/template.hpp" +#include #include "../../math/combinatorics/montgomery-mod-int.hpp" - #include "../../math/combinatorics/stirling-number-second.hpp" int main() { int N, K; - cin >> N >> K; - cout << stirling_number_second< modint1000000007 >(N, K) << endl; + std::cin >> N >> K; + std::cout << stirling_number_second(N, K) << std::endl; } - diff --git a/test/verify/aoj-dpl-5-j.test.cpp b/test/verify/aoj-dpl-5-j.test.cpp index d87401fbd..b1ef40958 100644 --- a/test/verify/aoj-dpl-5-j.test.cpp +++ b/test/verify/aoj-dpl-5-j.test.cpp @@ -1,13 +1,14 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_5_J +// clang-format on -#include "../../template/template.hpp" +#include #include "../../math/combinatorics/montgomery-mod-int.hpp" - #include "../../math/combinatorics/partition-table.hpp" int main() { int N, K; - cin >> N >> K; - cout << partition_table< modint1000000007 >(N, K)[N][K] << endl; + std::cin >> N >> K; + std::cout << partition_table(N, K)[N][K] << std::endl; } From 7e3ae0a32141afb9eb4683d076d6daccf8dd592c Mon Sep 17 00:00:00 2001 From: ei1333 Date: Mon, 10 Aug 2026 10:44:09 +0000 Subject: [PATCH 03/16] Migrate AOJ data structure verification tests --- SELF_CONTAINED_HEADER_MIGRATION.md | 3 ++- scripts/verify-template-include-allowlist.txt | 6 ----- test/verify/aoj-dsl-1-a.test.cpp | 16 ++++++++----- test/verify/aoj-dsl-1-b.test.cpp | 22 ++++++++++-------- test/verify/aoj-dsl-2-a.test.cpp | 23 ++++++++++++------- test/verify/aoj-dsl-2-b-2.test.cpp | 18 ++++++++------- test/verify/aoj-dsl-2-b.test.cpp | 18 +++++++++------ test/verify/aoj-dsl-2-d.test.cpp | 23 +++++++++++-------- 8 files changed, 73 insertions(+), 56 deletions(-) diff --git a/SELF_CONTAINED_HEADER_MIGRATION.md b/SELF_CONTAINED_HEADER_MIGRATION.md index 8559b44be..63deb8969 100644 --- a/SELF_CONTAINED_HEADER_MIGRATION.md +++ b/SELF_CONTAINED_HEADER_MIGRATION.md @@ -27,7 +27,7 @@ import と別名を意図的に提供する集約ヘッダーのため、自己 | ----------------------------------------- | -------- | ---- | | リポジトリ内の `.hpp` | 調査済み | 320 | | 自己完結化して継続検査しているヘッダー | 移行済み | 319 | -| `template/template.hpp` に依存する verify | 移行待ち | 233 | +| `template/template.hpp` に依存する verify | 移行待ち | 227 | 移行済みヘッダーの正本は [`scripts/self-contained-headers.txt`](scripts/self-contained-headers.txt)、 @@ -145,6 +145,7 @@ g++ -std=c++17 -fsyntax-only -x c++ -include ./path/to/header.hpp /dev/null | 2026-08-10 | 移行済みヘッダー34件 | 未修飾標準名と include guard を修正 | | 2026-08-10 | AOJ DPL の verify 7件 | テンプレート依存を削除 | | 2026-08-10 | AOJ DPL の組合せ verify 3件 | テンプレート依存を削除 | +| 2026-08-10 | AOJ DSL の verify 6件 | テンプレート依存を削除 | ## 次の候補 diff --git a/scripts/verify-template-include-allowlist.txt b/scripts/verify-template-include-allowlist.txt index 57f06859c..114c004b9 100644 --- a/scripts/verify-template-include-allowlist.txt +++ b/scripts/verify-template-include-allowlist.txt @@ -55,12 +55,6 @@ test/verify/aoj-cgl-4-c.test.cpp test/verify/aoj-cgl-7-d.test.cpp test/verify/aoj-cgl-7-e.test.cpp test/verify/aoj-cgl-7-h.test.cpp -test/verify/aoj-dsl-1-a.test.cpp -test/verify/aoj-dsl-1-b.test.cpp -test/verify/aoj-dsl-2-a.test.cpp -test/verify/aoj-dsl-2-b-2.test.cpp -test/verify/aoj-dsl-2-b.test.cpp -test/verify/aoj-dsl-2-d.test.cpp test/verify/aoj-grl-1-a-2.test.cpp test/verify/aoj-grl-1-a-3.test.cpp test/verify/aoj-grl-1-a.test.cpp diff --git a/test/verify/aoj-dsl-1-a.test.cpp b/test/verify/aoj-dsl-1-a.test.cpp index ea788c045..b4e8f3c53 100644 --- a/test/verify/aoj-dsl-1-a.test.cpp +++ b/test/verify/aoj-dsl-1-a.test.cpp @@ -1,17 +1,21 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_1_A +// clang-format on -#include "../../template/template.hpp" +#include #include "../../structure/union-find/union-find.hpp" int main() { int N, Q; - scanf("%d %d", &N, &Q); + std::scanf("%d %d", &N, &Q); UnionFind uf(N); - while(Q--) { + while (Q--) { int t, x, y; - scanf("%d %d %d", &t, &x, &y); - if(t == 0) uf.unite(x, y); - else printf("%d\n", uf.find(x) == uf.find(y)); + std::scanf("%d %d %d", &t, &x, &y); + if (t == 0) + uf.unite(x, y); + else + std::printf("%d\n", uf.find(x) == uf.find(y)); } } diff --git a/test/verify/aoj-dsl-1-b.test.cpp b/test/verify/aoj-dsl-1-b.test.cpp index e4ced038d..61d1dac0d 100644 --- a/test/verify/aoj-dsl-1-b.test.cpp +++ b/test/verify/aoj-dsl-1-b.test.cpp @@ -1,24 +1,26 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_1_B +// clang-format on -#include "../../template/template.hpp" +#include #include "../../structure/union-find/weighted-union-find.hpp" int main() { int N, M; - cin >> N >> M; - WeightedUnionFind< int > tree(N); - while(M--) { + std::cin >> N >> M; + WeightedUnionFind tree(N); + while (M--) { int A, B, C, D; - cin >> A >> B >> C; - if(A == 0) { - cin >> D; + std::cin >> A >> B >> C; + if (A == 0) { + std::cin >> D; tree.unite(B, C, D); } else { - if(tree.find(B) == tree.find(C)) { - cout << tree.diff(B, C) << endl; + if (tree.find(B) == tree.find(C)) { + std::cout << tree.diff(B, C) << std::endl; } else { - cout << "?" << endl; + std::cout << "?" << std::endl; } } } diff --git a/test/verify/aoj-dsl-2-a.test.cpp b/test/verify/aoj-dsl-2-a.test.cpp index 78a8e14a7..3c3215d84 100644 --- a/test/verify/aoj-dsl-2-a.test.cpp +++ b/test/verify/aoj-dsl-2-a.test.cpp @@ -1,19 +1,26 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_A +// clang-format on -#include "../../template/template.hpp" +#include +#include +#include #include "../../structure/segment-tree/segment-tree.hpp" int main() { int N, Q; - cin >> N >> Q; - auto seg = SegmentTree( - LambdaMonoid([](int a, int b) { return min(a, b); }, - []() { return INT_MAX; }), N); + std::cin >> N >> Q; + auto seg = + SegmentTree(LambdaMonoid([](int a, int b) { return std::min(a, b); }, + []() { return INT_MAX; }), + N); while (Q--) { int T, X, Y; - cin >> T >> X >> Y; - if (T == 0) seg.set(X, Y); - else cout << seg.prod(X, Y + 1) << "\n"; + std::cin >> T >> X >> Y; + if (T == 0) + seg.set(X, Y); + else + std::cout << seg.prod(X, Y + 1) << "\n"; } } diff --git a/test/verify/aoj-dsl-2-b-2.test.cpp b/test/verify/aoj-dsl-2-b-2.test.cpp index 5818397de..fdbcc227c 100644 --- a/test/verify/aoj-dsl-2-b-2.test.cpp +++ b/test/verify/aoj-dsl-2-b-2.test.cpp @@ -1,20 +1,22 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B +// clang-format on -#include "../../template/template.hpp" +#include #include "../../structure/trie/binary-trie.hpp" int main() { int N, Q; - cin >> N >> Q; - BinaryTrie< int, 20 > bt; - for(int i = 0; i < Q; i++) { + std::cin >> N >> Q; + BinaryTrie bt; + for (int i = 0; i < Q; i++) { int c, x, y; - cin >> c >> x >> y; - if(c == 0) { + std::cin >> c >> x >> y; + if (c == 0) { bt.add(x, -1, y); - } else if(c == 1) { - cout << bt.count_less(y + 1) - bt.count_less(x) << "\n"; + } else if (c == 1) { + std::cout << bt.count_less(y + 1) - bt.count_less(x) << "\n"; } } } diff --git a/test/verify/aoj-dsl-2-b.test.cpp b/test/verify/aoj-dsl-2-b.test.cpp index 9fdb1e350..34ef70e13 100644 --- a/test/verify/aoj-dsl-2-b.test.cpp +++ b/test/verify/aoj-dsl-2-b.test.cpp @@ -1,17 +1,21 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B +// clang-format on -#include "../../template/template.hpp" +#include #include "../../structure/others/binary-indexed-tree.hpp" int main() { int N, Q; - cin >> N >> Q; - BinaryIndexedTree< int > bit(N); - while(Q--) { + std::cin >> N >> Q; + BinaryIndexedTree bit(N); + while (Q--) { int T, X, Y; - cin >> T >> X >> Y; - if(T == 0) bit.apply(X - 1, Y); - else cout << bit.prod(X - 1, Y) << "\n"; + std::cin >> T >> X >> Y; + if (T == 0) + bit.apply(X - 1, Y); + else + std::cout << bit.prod(X - 1, Y) << "\n"; } } diff --git a/test/verify/aoj-dsl-2-d.test.cpp b/test/verify/aoj-dsl-2-d.test.cpp index 5dd08c4c6..1373199ee 100644 --- a/test/verify/aoj-dsl-2-d.test.cpp +++ b/test/verify/aoj-dsl-2-d.test.cpp @@ -1,26 +1,29 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_D +// clang-format on -#include "../../template/template.hpp" +#include +#include #include "../../structure/segment-tree/dual-segment-tree.hpp" int main() { int N, Q; - cin >> N >> Q; - auto h = [](int a, int b) { return b; }; + std::cin >> N >> Q; + auto h = [](int, int b) { return b; }; auto id = []() { return INT_MAX; }; DualSegmentTree seg(LambdaAct(h, id), N); - while(Q--) { + while (Q--) { int com; - cin >> com; - if(com == 0) { + std::cin >> com; + if (com == 0) { int l, r, x; - cin >> l >> r >> x; + std::cin >> l >> r >> x; seg.apply(l, r + 1, x); - } else if(com == 1) { + } else if (com == 1) { int k; - cin >> k; - cout << seg[k] << "\n"; + std::cin >> k; + std::cout << seg[k] << "\n"; } } } From 96ad31d21e8922adf34190994927477c059644fb Mon Sep 17 00:00:00 2001 From: ei1333 Date: Mon, 10 Aug 2026 10:46:05 +0000 Subject: [PATCH 04/16] Allow std namespace in verification tests --- SELF_CONTAINED_HEADER_MIGRATION.md | 3 ++- test/verify/aoj-dpl-1-b.test.cpp | 10 ++++++---- test/verify/aoj-dpl-1-c.test.cpp | 10 ++++++---- test/verify/aoj-dpl-1-d.test.cpp | 10 ++++++---- test/verify/aoj-dpl-1-e.test.cpp | 8 +++++--- test/verify/aoj-dpl-1-f.test.cpp | 10 ++++++---- test/verify/aoj-dpl-1-i.test.cpp | 12 +++++++----- test/verify/aoj-dpl-3-c.test.cpp | 10 ++++++---- test/verify/aoj-dpl-5-g.test.cpp | 6 ++++-- test/verify/aoj-dpl-5-i.test.cpp | 6 ++++-- test/verify/aoj-dpl-5-j.test.cpp | 6 ++++-- test/verify/aoj-dsl-1-a.test.cpp | 8 +++++--- test/verify/aoj-dsl-1-b.test.cpp | 12 +++++++----- test/verify/aoj-dsl-2-a.test.cpp | 15 ++++++++------- test/verify/aoj-dsl-2-b-2.test.cpp | 8 +++++--- test/verify/aoj-dsl-2-b.test.cpp | 8 +++++--- test/verify/aoj-dsl-2-d.test.cpp | 12 +++++++----- 17 files changed, 93 insertions(+), 61 deletions(-) diff --git a/SELF_CONTAINED_HEADER_MIGRATION.md b/SELF_CONTAINED_HEADER_MIGRATION.md index 63deb8969..6273fe56c 100644 --- a/SELF_CONTAINED_HEADER_MIGRATION.md +++ b/SELF_CONTAINED_HEADER_MIGRATION.md @@ -59,7 +59,8 @@ import と別名を意図的に提供する集約ヘッダーのため、自己 依存先ヘッダーが自己完結した後、対応する verify から `template/template.hpp` を削除する。必要な標準ヘッダー、型別名、入出力処理、 -補助関数は verify 側に明示する。移行後は +補助関数は verify 側に明示する。verify では簡潔さのため +`using namespace std;` の使用を許可する。移行後は `scripts/verify-template-include-allowlist.txt` から対象を削除する。 ### 4. 移行済みコードの逆戻りを防ぐ diff --git a/test/verify/aoj-dpl-1-b.test.cpp b/test/verify/aoj-dpl-1-b.test.cpp index aea373ac4..f56b2d3d5 100644 --- a/test/verify/aoj-dpl-1-b.test.cpp +++ b/test/verify/aoj-dpl-1-b.test.cpp @@ -8,11 +8,13 @@ #include "../../dp/knapsack-01.hpp" +using namespace std; + int main() { int N, W; - std::cin >> N >> W; - std::vector v(N), w(N); - for (int i = 0; i < N; i++) std::cin >> v[i] >> w[i]; + cin >> N >> W; + vector v(N), w(N); + for (int i = 0; i < N; i++) cin >> v[i] >> w[i]; auto ret = knapsack_01(w, v, W, -1); - std::cout << *std::max_element(ret.begin(), ret.end()) << std::endl; + cout << *max_element(ret.begin(), ret.end()) << endl; } diff --git a/test/verify/aoj-dpl-1-c.test.cpp b/test/verify/aoj-dpl-1-c.test.cpp index 05b3ce630..9b99ba0fa 100644 --- a/test/verify/aoj-dpl-1-c.test.cpp +++ b/test/verify/aoj-dpl-1-c.test.cpp @@ -8,11 +8,13 @@ #include "../../dp/knapsack.hpp" +using namespace std; + int main() { int N, W; - std::cin >> N >> W; - std::vector v(N), w(N); - for (int i = 0; i < N; i++) std::cin >> v[i] >> w[i]; + cin >> N >> W; + vector v(N), w(N); + for (int i = 0; i < N; i++) cin >> v[i] >> w[i]; auto ret = knapsack(w, v, W, -1); - std::cout << *std::max_element(ret.begin(), ret.end()) << std::endl; + cout << *max_element(ret.begin(), ret.end()) << endl; } diff --git a/test/verify/aoj-dpl-1-d.test.cpp b/test/verify/aoj-dpl-1-d.test.cpp index d9ee70289..59582a271 100644 --- a/test/verify/aoj-dpl-1-d.test.cpp +++ b/test/verify/aoj-dpl-1-d.test.cpp @@ -7,10 +7,12 @@ #include "../../dp/longest-increasing-subsequence.hpp" +using namespace std; + int main() { int N; - std::cin >> N; - std::vector A(N); - for (int& a : A) std::cin >> a; - std::cout << longest_increasing_subsequence(A, true) << std::endl; + cin >> N; + vector A(N); + for (int& a : A) cin >> a; + cout << longest_increasing_subsequence(A, true) << endl; } diff --git a/test/verify/aoj-dpl-1-e.test.cpp b/test/verify/aoj-dpl-1-e.test.cpp index 7186e7d32..c574d0b7d 100644 --- a/test/verify/aoj-dpl-1-e.test.cpp +++ b/test/verify/aoj-dpl-1-e.test.cpp @@ -7,8 +7,10 @@ #include "../../dp/edit-distance.hpp" +using namespace std; + int main() { - std::string S, T; - std::cin >> S >> T; - std::cout << edit_distance(S, T) << std::endl; + string S, T; + cin >> S >> T; + cout << edit_distance(S, T) << endl; } diff --git a/test/verify/aoj-dpl-1-f.test.cpp b/test/verify/aoj-dpl-1-f.test.cpp index f2b1bdff0..82705a683 100644 --- a/test/verify/aoj-dpl-1-f.test.cpp +++ b/test/verify/aoj-dpl-1-f.test.cpp @@ -7,10 +7,12 @@ #include "../../dp/knapsack-01-2.hpp" +using namespace std; + int main() { int N, W; - std::cin >> N >> W; - std::vector v(N), w(N); - for (int i = 0; i < N; i++) std::cin >> v[i] >> w[i]; - std::cout << knapsack_01_2(w, v, W) << std::endl; + cin >> N >> W; + vector v(N), w(N); + for (int i = 0; i < N; i++) cin >> v[i] >> w[i]; + cout << knapsack_01_2(w, v, W) << endl; } diff --git a/test/verify/aoj-dpl-1-i.test.cpp b/test/verify/aoj-dpl-1-i.test.cpp index 4eb9ec9c4..394fb8b29 100644 --- a/test/verify/aoj-dpl-1-i.test.cpp +++ b/test/verify/aoj-dpl-1-i.test.cpp @@ -7,14 +7,16 @@ #include "../../dp/knapsack-limitations-2.hpp" +using namespace std; + int main() { int N; long long W; - std::cin >> N >> W; - std::vector v(N); - std::vector w(N), m(N); + cin >> N >> W; + vector v(N); + vector w(N), m(N); for (int i = 0; i < N; i++) { - std::cin >> v[i] >> w[i] >> m[i]; + cin >> v[i] >> w[i] >> m[i]; } - std::cout << knapsack_limitations(w, m, v, W) << std::endl; + cout << knapsack_limitations(w, m, v, W) << endl; } diff --git a/test/verify/aoj-dpl-3-c.test.cpp b/test/verify/aoj-dpl-3-c.test.cpp index c1a2ca370..659bb2199 100644 --- a/test/verify/aoj-dpl-3-c.test.cpp +++ b/test/verify/aoj-dpl-3-c.test.cpp @@ -7,10 +7,12 @@ #include "../../dp/largest-rectangle.hpp" +using namespace std; + int main() { int N; - std::cin >> N; - std::vector h(N); - for (int& height : h) std::cin >> height; - std::cout << largest_rectangle(h) << std::endl; + cin >> N; + vector h(N); + for (int& height : h) cin >> height; + cout << largest_rectangle(h) << endl; } diff --git a/test/verify/aoj-dpl-5-g.test.cpp b/test/verify/aoj-dpl-5-g.test.cpp index f3a7f6ac0..39c1d4c76 100644 --- a/test/verify/aoj-dpl-5-g.test.cpp +++ b/test/verify/aoj-dpl-5-g.test.cpp @@ -7,8 +7,10 @@ #include "../../math/combinatorics/bell-number.hpp" #include "../../math/combinatorics/montgomery-mod-int.hpp" +using namespace std; + int main() { int N, K; - std::cin >> N >> K; - std::cout << bell_number(N, K) << std::endl; + cin >> N >> K; + cout << bell_number(N, K) << endl; } diff --git a/test/verify/aoj-dpl-5-i.test.cpp b/test/verify/aoj-dpl-5-i.test.cpp index f39d31db2..d9b9d05b0 100644 --- a/test/verify/aoj-dpl-5-i.test.cpp +++ b/test/verify/aoj-dpl-5-i.test.cpp @@ -7,8 +7,10 @@ #include "../../math/combinatorics/montgomery-mod-int.hpp" #include "../../math/combinatorics/stirling-number-second.hpp" +using namespace std; + int main() { int N, K; - std::cin >> N >> K; - std::cout << stirling_number_second(N, K) << std::endl; + cin >> N >> K; + cout << stirling_number_second(N, K) << endl; } diff --git a/test/verify/aoj-dpl-5-j.test.cpp b/test/verify/aoj-dpl-5-j.test.cpp index b1ef40958..c8b2d3e72 100644 --- a/test/verify/aoj-dpl-5-j.test.cpp +++ b/test/verify/aoj-dpl-5-j.test.cpp @@ -7,8 +7,10 @@ #include "../../math/combinatorics/montgomery-mod-int.hpp" #include "../../math/combinatorics/partition-table.hpp" +using namespace std; + int main() { int N, K; - std::cin >> N >> K; - std::cout << partition_table(N, K)[N][K] << std::endl; + cin >> N >> K; + cout << partition_table(N, K)[N][K] << endl; } diff --git a/test/verify/aoj-dsl-1-a.test.cpp b/test/verify/aoj-dsl-1-a.test.cpp index b4e8f3c53..a4306ba0e 100644 --- a/test/verify/aoj-dsl-1-a.test.cpp +++ b/test/verify/aoj-dsl-1-a.test.cpp @@ -6,16 +6,18 @@ #include "../../structure/union-find/union-find.hpp" +using namespace std; + int main() { int N, Q; - std::scanf("%d %d", &N, &Q); + scanf("%d %d", &N, &Q); UnionFind uf(N); while (Q--) { int t, x, y; - std::scanf("%d %d %d", &t, &x, &y); + scanf("%d %d %d", &t, &x, &y); if (t == 0) uf.unite(x, y); else - std::printf("%d\n", uf.find(x) == uf.find(y)); + printf("%d\n", uf.find(x) == uf.find(y)); } } diff --git a/test/verify/aoj-dsl-1-b.test.cpp b/test/verify/aoj-dsl-1-b.test.cpp index 61d1dac0d..7e55eeff2 100644 --- a/test/verify/aoj-dsl-1-b.test.cpp +++ b/test/verify/aoj-dsl-1-b.test.cpp @@ -6,21 +6,23 @@ #include "../../structure/union-find/weighted-union-find.hpp" +using namespace std; + int main() { int N, M; - std::cin >> N >> M; + cin >> N >> M; WeightedUnionFind tree(N); while (M--) { int A, B, C, D; - std::cin >> A >> B >> C; + cin >> A >> B >> C; if (A == 0) { - std::cin >> D; + cin >> D; tree.unite(B, C, D); } else { if (tree.find(B) == tree.find(C)) { - std::cout << tree.diff(B, C) << std::endl; + cout << tree.diff(B, C) << endl; } else { - std::cout << "?" << std::endl; + cout << "?" << endl; } } } diff --git a/test/verify/aoj-dsl-2-a.test.cpp b/test/verify/aoj-dsl-2-a.test.cpp index 3c3215d84..0fb18349e 100644 --- a/test/verify/aoj-dsl-2-a.test.cpp +++ b/test/verify/aoj-dsl-2-a.test.cpp @@ -8,19 +8,20 @@ #include "../../structure/segment-tree/segment-tree.hpp" +using namespace std; + int main() { int N, Q; - std::cin >> N >> Q; - auto seg = - SegmentTree(LambdaMonoid([](int a, int b) { return std::min(a, b); }, - []() { return INT_MAX; }), - N); + cin >> N >> Q; + auto seg = SegmentTree(LambdaMonoid([](int a, int b) { return min(a, b); }, + []() { return INT_MAX; }), + N); while (Q--) { int T, X, Y; - std::cin >> T >> X >> Y; + cin >> T >> X >> Y; if (T == 0) seg.set(X, Y); else - std::cout << seg.prod(X, Y + 1) << "\n"; + cout << seg.prod(X, Y + 1) << "\n"; } } diff --git a/test/verify/aoj-dsl-2-b-2.test.cpp b/test/verify/aoj-dsl-2-b-2.test.cpp index fdbcc227c..3cd6bec50 100644 --- a/test/verify/aoj-dsl-2-b-2.test.cpp +++ b/test/verify/aoj-dsl-2-b-2.test.cpp @@ -6,17 +6,19 @@ #include "../../structure/trie/binary-trie.hpp" +using namespace std; + int main() { int N, Q; - std::cin >> N >> Q; + cin >> N >> Q; BinaryTrie bt; for (int i = 0; i < Q; i++) { int c, x, y; - std::cin >> c >> x >> y; + cin >> c >> x >> y; if (c == 0) { bt.add(x, -1, y); } else if (c == 1) { - std::cout << bt.count_less(y + 1) - bt.count_less(x) << "\n"; + cout << bt.count_less(y + 1) - bt.count_less(x) << "\n"; } } } diff --git a/test/verify/aoj-dsl-2-b.test.cpp b/test/verify/aoj-dsl-2-b.test.cpp index 34ef70e13..75fb2e9df 100644 --- a/test/verify/aoj-dsl-2-b.test.cpp +++ b/test/verify/aoj-dsl-2-b.test.cpp @@ -6,16 +6,18 @@ #include "../../structure/others/binary-indexed-tree.hpp" +using namespace std; + int main() { int N, Q; - std::cin >> N >> Q; + cin >> N >> Q; BinaryIndexedTree bit(N); while (Q--) { int T, X, Y; - std::cin >> T >> X >> Y; + cin >> T >> X >> Y; if (T == 0) bit.apply(X - 1, Y); else - std::cout << bit.prod(X - 1, Y) << "\n"; + cout << bit.prod(X - 1, Y) << "\n"; } } diff --git a/test/verify/aoj-dsl-2-d.test.cpp b/test/verify/aoj-dsl-2-d.test.cpp index 1373199ee..dfce933c4 100644 --- a/test/verify/aoj-dsl-2-d.test.cpp +++ b/test/verify/aoj-dsl-2-d.test.cpp @@ -7,23 +7,25 @@ #include "../../structure/segment-tree/dual-segment-tree.hpp" +using namespace std; + int main() { int N, Q; - std::cin >> N >> Q; + cin >> N >> Q; auto h = [](int, int b) { return b; }; auto id = []() { return INT_MAX; }; DualSegmentTree seg(LambdaAct(h, id), N); while (Q--) { int com; - std::cin >> com; + cin >> com; if (com == 0) { int l, r, x; - std::cin >> l >> r >> x; + cin >> l >> r >> x; seg.apply(l, r + 1, x); } else if (com == 1) { int k; - std::cin >> k; - std::cout << seg[k] << "\n"; + cin >> k; + cout << seg[k] << "\n"; } } } From c75d511aaf8aecfa0a9fc3bd430b67e0f2cec48d Mon Sep 17 00:00:00 2001 From: ei1333 Date: Mon, 10 Aug 2026 10:48:01 +0000 Subject: [PATCH 05/16] Migrate AOJ shortest path verification tests --- SELF_CONTAINED_HEADER_MIGRATION.md | 3 +- scripts/verify-template-include-allowlist.txt | 6 ---- test/verify/aoj-grl-1-a-2.test.cpp | 17 ++++++--- test/verify/aoj-grl-1-a-3.test.cpp | 19 ++++++---- test/verify/aoj-grl-1-a.test.cpp | 17 ++++++--- test/verify/aoj-grl-1-b-2.test.cpp | 19 ++++++---- test/verify/aoj-grl-1-b.test.cpp | 23 +++++++----- test/verify/aoj-grl-1-c.test.cpp | 35 +++++++++++-------- 8 files changed, 87 insertions(+), 52 deletions(-) diff --git a/SELF_CONTAINED_HEADER_MIGRATION.md b/SELF_CONTAINED_HEADER_MIGRATION.md index 6273fe56c..a9dc3b636 100644 --- a/SELF_CONTAINED_HEADER_MIGRATION.md +++ b/SELF_CONTAINED_HEADER_MIGRATION.md @@ -27,7 +27,7 @@ import と別名を意図的に提供する集約ヘッダーのため、自己 | ----------------------------------------- | -------- | ---- | | リポジトリ内の `.hpp` | 調査済み | 320 | | 自己完結化して継続検査しているヘッダー | 移行済み | 319 | -| `template/template.hpp` に依存する verify | 移行待ち | 227 | +| `template/template.hpp` に依存する verify | 移行待ち | 221 | 移行済みヘッダーの正本は [`scripts/self-contained-headers.txt`](scripts/self-contained-headers.txt)、 @@ -147,6 +147,7 @@ g++ -std=c++17 -fsyntax-only -x c++ -include ./path/to/header.hpp /dev/null | 2026-08-10 | AOJ DPL の verify 7件 | テンプレート依存を削除 | | 2026-08-10 | AOJ DPL の組合せ verify 3件 | テンプレート依存を削除 | | 2026-08-10 | AOJ DSL の verify 6件 | テンプレート依存を削除 | +| 2026-08-10 | AOJ GRL の最短路 verify 6件 | テンプレート依存を削除 | ## 次の候補 diff --git a/scripts/verify-template-include-allowlist.txt b/scripts/verify-template-include-allowlist.txt index 114c004b9..226aa9797 100644 --- a/scripts/verify-template-include-allowlist.txt +++ b/scripts/verify-template-include-allowlist.txt @@ -55,12 +55,6 @@ test/verify/aoj-cgl-4-c.test.cpp test/verify/aoj-cgl-7-d.test.cpp test/verify/aoj-cgl-7-e.test.cpp test/verify/aoj-cgl-7-h.test.cpp -test/verify/aoj-grl-1-a-2.test.cpp -test/verify/aoj-grl-1-a-3.test.cpp -test/verify/aoj-grl-1-a.test.cpp -test/verify/aoj-grl-1-b-2.test.cpp -test/verify/aoj-grl-1-b.test.cpp -test/verify/aoj-grl-1-c.test.cpp test/verify/aoj-grl-2-a-2.test.cpp test/verify/aoj-grl-2-a-3.test.cpp test/verify/aoj-grl-2-a-4.test.cpp diff --git a/test/verify/aoj-grl-1-a-2.test.cpp b/test/verify/aoj-grl-1-a-2.test.cpp index 8c3ffbf4c..37f5c5fd0 100644 --- a/test/verify/aoj-grl-1-a-2.test.cpp +++ b/test/verify/aoj-grl-1-a-2.test.cpp @@ -1,16 +1,23 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_A +// clang-format on -#include "../../template/template.hpp" +#include +#include #include "../../graph/shortest-path/dijkstra-fibonacchi-heap.hpp" +using namespace std; + int main() { int V, E, R; cin >> V >> E >> R; - Graph< int > g(V); + Graph g(V); g.read(E, 0, true, true); - for(auto &dist : dijkstra_fibonacchi_heap(g, R)) { - if(dist == numeric_limits< int >::max()) cout << "INF\n"; - else cout << dist << "\n"; + for (auto& dist : dijkstra_fibonacchi_heap(g, R)) { + if (dist == numeric_limits::max()) + cout << "INF\n"; + else + cout << dist << "\n"; } } diff --git a/test/verify/aoj-grl-1-a-3.test.cpp b/test/verify/aoj-grl-1-a-3.test.cpp index b18a591f8..ef5135c97 100644 --- a/test/verify/aoj-grl-1-a-3.test.cpp +++ b/test/verify/aoj-grl-1-a-3.test.cpp @@ -1,18 +1,23 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_A +// clang-format on -#include "../../template/template.hpp" - -#include "../../structure/heap/radix-heap.hpp" +#include +#include #include "../../graph/shortest-path/dijkstra-radix-heap.hpp" +using namespace std; + int main() { int V, E, R; cin >> V >> E >> R; - Graph< int > g(V); + Graph g(V); g.read(E, 0, true, true); - for(auto &dist : dijkstra_radix_heap(g, R)) { - if(dist == numeric_limits< int >::max()) cout << "INF\n"; - else cout << dist << "\n"; + for (auto& dist : dijkstra_radix_heap(g, R)) { + if (dist == numeric_limits::max()) + cout << "INF\n"; + else + cout << dist << "\n"; } } diff --git a/test/verify/aoj-grl-1-a.test.cpp b/test/verify/aoj-grl-1-a.test.cpp index fb64bff87..eb683656d 100644 --- a/test/verify/aoj-grl-1-a.test.cpp +++ b/test/verify/aoj-grl-1-a.test.cpp @@ -1,16 +1,23 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_A +// clang-format on -#include "../../template/template.hpp" +#include +#include #include "../../graph/shortest-path/dijkstra.hpp" +using namespace std; + int main() { int V, E, R; cin >> V >> E >> R; - Graph< int > g(V); + Graph g(V); g.read(E, 0, true, true); - for(auto &dist : dijkstra(g, R).dist) { - if(dist == numeric_limits< int >::max()) cout << "INF\n"; - else cout << dist << "\n"; + for (auto& dist : dijkstra(g, R).dist) { + if (dist == numeric_limits::max()) + cout << "INF\n"; + else + cout << dist << "\n"; } } diff --git a/test/verify/aoj-grl-1-b-2.test.cpp b/test/verify/aoj-grl-1-b-2.test.cpp index 767822aaf..c72b13dfc 100644 --- a/test/verify/aoj-grl-1-b-2.test.cpp +++ b/test/verify/aoj-grl-1-b-2.test.cpp @@ -1,18 +1,25 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_B +// clang-format on -#include "../../template/template.hpp" +#include +#include #include "../../graph/shortest-path/shortest-path-faster-algorithm.hpp" +using namespace std; + int main() { int V, E, R; cin >> V >> E >> R; - Graph< int > g(V); + Graph g(V); g.read(E, 0, true, true); auto dists = shortest_path_faster_algorithm(g, R); - if(dists.empty()) cout << "NEGATIVE CYCLE\n"; - for(auto &dist : dists) { - if(dist == numeric_limits< int >::max()) cout << "INF\n"; - else cout << dist << "\n"; + if (dists.empty()) cout << "NEGATIVE CYCLE\n"; + for (auto& dist : dists) { + if (dist == numeric_limits::max()) + cout << "INF\n"; + else + cout << dist << "\n"; } } diff --git a/test/verify/aoj-grl-1-b.test.cpp b/test/verify/aoj-grl-1-b.test.cpp index 4fa453523..0e3b831aa 100644 --- a/test/verify/aoj-grl-1-b.test.cpp +++ b/test/verify/aoj-grl-1-b.test.cpp @@ -1,27 +1,34 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_B +// clang-format on -#include "../../template/template.hpp" +#include +#include #include "../../graph/shortest-path/bellman-ford.hpp" +using namespace std; + int main() { int V, E, R; cin >> V >> E >> R; - Edges< > es; - for(int i = 0; i < E; i++) { + Edges<> es; + for (int i = 0; i < E; i++) { int a, b, c; cin >> a >> b >> c; es.emplace_back(a, b, c); } auto dists = bellman_ford(es, V, R); - for(auto& dist : dists) { - if(dist == numeric_limits< int >::min()) { + for (auto& dist : dists) { + if (dist == numeric_limits::min()) { cout << "NEGATIVE CYCLE\n"; return 0; } } - for(auto &dist : dists) { - if(dist == numeric_limits< int >::max()) cout << "INF\n"; - else cout << dist << "\n"; + for (auto& dist : dists) { + if (dist == numeric_limits::max()) + cout << "INF\n"; + else + cout << dist << "\n"; } } diff --git a/test/verify/aoj-grl-1-c.test.cpp b/test/verify/aoj-grl-1-c.test.cpp index e665b83df..185a7b7cf 100644 --- a/test/verify/aoj-grl-1-c.test.cpp +++ b/test/verify/aoj-grl-1-c.test.cpp @@ -1,36 +1,43 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_C +// clang-format on -#include "../../template/template.hpp" +#include +#include -#include "../../math/matrix/square-matrix.hpp" #include "../../graph/shortest-path/warshall-floyd.hpp" +#include "../../math/matrix/square-matrix.hpp" + +using namespace std; int main() { int V, E; scanf("%d %d", &V, &E); - SquareMatrix< int, 100 > mat; - for(int i = 0; i < 100; i++) { - for(int j = 0; j < 100; j++) { - if(i != j) mat[i][j] = INT_MAX; + SquareMatrix mat; + for (int i = 0; i < 100; i++) { + for (int j = 0; j < 100; j++) { + if (i != j) mat[i][j] = INT_MAX; } } - for(int i = 0; i < E; i++) { + for (int i = 0; i < E; i++) { int x, y, z; scanf("%d %d %d", &x, &y, &z); mat[x][y] = z; } warshall_floyd(mat, INT_MAX); - for(int i = 0; i < V; i++) { - if(mat[i][i] < 0) { + for (int i = 0; i < V; i++) { + if (mat[i][i] < 0) { puts("NEGATIVE CYCLE"); return 0; } } - for(int i = 0; i < V; i++) { - for(int j = 0; j < V; j++) { - if(j > 0) putchar(' '); - if(mat[i][j] == INT_MAX) printf("INF"); - else printf("%d", mat[i][j]); + for (int i = 0; i < V; i++) { + for (int j = 0; j < V; j++) { + if (j > 0) putchar(' '); + if (mat[i][j] == INT_MAX) + printf("INF"); + else + printf("%d", mat[i][j]); } putchar('\n'); } From 0aadc23d82440e6184ce2587c8427b7b4fc34c21 Mon Sep 17 00:00:00 2001 From: ei1333 Date: Mon, 10 Aug 2026 10:49:23 +0000 Subject: [PATCH 06/16] Migrate AOJ spanning tree verification tests --- SELF_CONTAINED_HEADER_MIGRATION.md | 3 ++- scripts/verify-template-include-allowlist.txt | 5 ----- test/verify/aoj-grl-2-a-2.test.cpp | 10 ++++++--- test/verify/aoj-grl-2-a-3.test.cpp | 21 ++++++++++++------- test/verify/aoj-grl-2-a-4.test.cpp | 6 +++++- test/verify/aoj-grl-2-a.test.cpp | 6 +++++- test/verify/aoj-grl-2-b.test.cpp | 10 ++++++--- 7 files changed, 40 insertions(+), 21 deletions(-) diff --git a/SELF_CONTAINED_HEADER_MIGRATION.md b/SELF_CONTAINED_HEADER_MIGRATION.md index a9dc3b636..0427339e2 100644 --- a/SELF_CONTAINED_HEADER_MIGRATION.md +++ b/SELF_CONTAINED_HEADER_MIGRATION.md @@ -27,7 +27,7 @@ import と別名を意図的に提供する集約ヘッダーのため、自己 | ----------------------------------------- | -------- | ---- | | リポジトリ内の `.hpp` | 調査済み | 320 | | 自己完結化して継続検査しているヘッダー | 移行済み | 319 | -| `template/template.hpp` に依存する verify | 移行待ち | 221 | +| `template/template.hpp` に依存する verify | 移行待ち | 216 | 移行済みヘッダーの正本は [`scripts/self-contained-headers.txt`](scripts/self-contained-headers.txt)、 @@ -148,6 +148,7 @@ g++ -std=c++17 -fsyntax-only -x c++ -include ./path/to/header.hpp /dev/null | 2026-08-10 | AOJ DPL の組合せ verify 3件 | テンプレート依存を削除 | | 2026-08-10 | AOJ DSL の verify 6件 | テンプレート依存を削除 | | 2026-08-10 | AOJ GRL の最短路 verify 6件 | テンプレート依存を削除 | +| 2026-08-10 | AOJ GRL の全域木 verify 5件 | テンプレート依存を削除 | ## 次の候補 diff --git a/scripts/verify-template-include-allowlist.txt b/scripts/verify-template-include-allowlist.txt index 226aa9797..ff3fe0a89 100644 --- a/scripts/verify-template-include-allowlist.txt +++ b/scripts/verify-template-include-allowlist.txt @@ -55,11 +55,6 @@ test/verify/aoj-cgl-4-c.test.cpp test/verify/aoj-cgl-7-d.test.cpp test/verify/aoj-cgl-7-e.test.cpp test/verify/aoj-cgl-7-h.test.cpp -test/verify/aoj-grl-2-a-2.test.cpp -test/verify/aoj-grl-2-a-3.test.cpp -test/verify/aoj-grl-2-a-4.test.cpp -test/verify/aoj-grl-2-a.test.cpp -test/verify/aoj-grl-2-b.test.cpp test/verify/aoj-grl-3-a.test.cpp test/verify/aoj-grl-3-b.test.cpp test/verify/aoj-grl-3-c.test.cpp diff --git a/test/verify/aoj-grl-2-a-2.test.cpp b/test/verify/aoj-grl-2-a-2.test.cpp index b5a48084a..b8bdca011 100644 --- a/test/verify/aoj-grl-2-a-2.test.cpp +++ b/test/verify/aoj-grl-2-a-2.test.cpp @@ -1,14 +1,18 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_2_A +// clang-format on -#include "../../template/template.hpp" +#include #include "../../graph/mst/kruskal.hpp" +using namespace std; + int main() { int V, E; cin >> V >> E; - Edges< int > edges; - for(int i = 0; i < E; i++) { + Edges edges; + for (int i = 0; i < E; i++) { int a, b, c; cin >> a >> b >> c; edges.emplace_back(a, b, c); diff --git a/test/verify/aoj-grl-2-a-3.test.cpp b/test/verify/aoj-grl-2-a-3.test.cpp index 54eed4ba3..76228ed3c 100644 --- a/test/verify/aoj-grl-2-a-3.test.cpp +++ b/test/verify/aoj-grl-2-a-3.test.cpp @@ -1,22 +1,29 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_2_A +// clang-format on -#include "../../template/template.hpp" +#include +#include +#include +#include #include "../../graph/mst/boruvka.hpp" +using namespace std; + int main() { int V, E; cin >> V >> E; - vector< int > X(E), Y(E), Z(E); - for(int i = 0; i < E; i++) { + vector X(E), Y(E), Z(E); + for (int i = 0; i < E; i++) { cin >> X[i] >> Y[i] >> Z[i]; } - Boruvka< int > mst(V); - auto f = [&](vector< pair< int, int > > &ret) { - for(int i = 0; i < E; i++) { + Boruvka mst(V); + auto f = [&](vector>& ret) { + for (int i = 0; i < E; i++) { X[i] = mst.find(X[i]); Y[i] = mst.find(Y[i]); - if(X[i] == Y[i]) continue; + if (X[i] == Y[i]) continue; ret[X[i]] = min(ret[X[i]], make_pair(Z[i], Y[i])); ret[Y[i]] = min(ret[Y[i]], make_pair(Z[i], X[i])); } diff --git a/test/verify/aoj-grl-2-a-4.test.cpp b/test/verify/aoj-grl-2-a-4.test.cpp index 06c2f14a5..fca4c9618 100644 --- a/test/verify/aoj-grl-2-a-4.test.cpp +++ b/test/verify/aoj-grl-2-a-4.test.cpp @@ -1,9 +1,13 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_2_A +// clang-format on -#include "../../template/template.hpp" +#include #include "../../graph/mst/prim-fibonacchi-heap.hpp" +using namespace std; + int main() { int V, E; cin >> V >> E; diff --git a/test/verify/aoj-grl-2-a.test.cpp b/test/verify/aoj-grl-2-a.test.cpp index 3ff531e3e..aa038a550 100644 --- a/test/verify/aoj-grl-2-a.test.cpp +++ b/test/verify/aoj-grl-2-a.test.cpp @@ -1,9 +1,13 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_2_A +// clang-format on -#include "../../template/template.hpp" +#include #include "../../graph/mst/prim.hpp" +using namespace std; + int main() { int V, E; cin >> V >> E; diff --git a/test/verify/aoj-grl-2-b.test.cpp b/test/verify/aoj-grl-2-b.test.cpp index 3a03612d2..1f051e8fb 100644 --- a/test/verify/aoj-grl-2-b.test.cpp +++ b/test/verify/aoj-grl-2-b.test.cpp @@ -1,14 +1,18 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_2_B +// clang-format on -#include "../../template/template.hpp" +#include #include "../../graph/mst/directed-mst.hpp" +using namespace std; + int main() { int V, E, R; cin >> V >> E >> R; - Edges< int > edges; - for(int i = 0; i < E; i++) { + Edges edges; + for (int i = 0; i < E; i++) { int a, b, c; cin >> a >> b >> c; edges.emplace_back(a, b, c); From 993f9079b0077a222be24f79c7e3ac4c3e92cb85 Mon Sep 17 00:00:00 2001 From: ei1333 Date: Mon, 10 Aug 2026 10:50:44 +0000 Subject: [PATCH 07/16] Migrate AOJ graph connectivity verification tests --- SELF_CONTAINED_HEADER_MIGRATION.md | 3 ++- scripts/verify-template-include-allowlist.txt | 3 --- test/verify/aoj-grl-3-a.test.cpp | 12 ++++++++---- test/verify/aoj-grl-3-b.test.cpp | 17 ++++++++++++----- test/verify/aoj-grl-3-c.test.cpp | 10 +++++++--- 5 files changed, 29 insertions(+), 16 deletions(-) diff --git a/SELF_CONTAINED_HEADER_MIGRATION.md b/SELF_CONTAINED_HEADER_MIGRATION.md index 0427339e2..0ec1152b0 100644 --- a/SELF_CONTAINED_HEADER_MIGRATION.md +++ b/SELF_CONTAINED_HEADER_MIGRATION.md @@ -27,7 +27,7 @@ import と別名を意図的に提供する集約ヘッダーのため、自己 | ----------------------------------------- | -------- | ---- | | リポジトリ内の `.hpp` | 調査済み | 320 | | 自己完結化して継続検査しているヘッダー | 移行済み | 319 | -| `template/template.hpp` に依存する verify | 移行待ち | 216 | +| `template/template.hpp` に依存する verify | 移行待ち | 213 | 移行済みヘッダーの正本は [`scripts/self-contained-headers.txt`](scripts/self-contained-headers.txt)、 @@ -149,6 +149,7 @@ g++ -std=c++17 -fsyntax-only -x c++ -include ./path/to/header.hpp /dev/null | 2026-08-10 | AOJ DSL の verify 6件 | テンプレート依存を削除 | | 2026-08-10 | AOJ GRL の最短路 verify 6件 | テンプレート依存を削除 | | 2026-08-10 | AOJ GRL の全域木 verify 5件 | テンプレート依存を削除 | +| 2026-08-10 | AOJ GRL の連結性 verify 3件 | テンプレート依存を削除 | ## 次の候補 diff --git a/scripts/verify-template-include-allowlist.txt b/scripts/verify-template-include-allowlist.txt index ff3fe0a89..b18a0d9d0 100644 --- a/scripts/verify-template-include-allowlist.txt +++ b/scripts/verify-template-include-allowlist.txt @@ -55,9 +55,6 @@ test/verify/aoj-cgl-4-c.test.cpp test/verify/aoj-cgl-7-d.test.cpp test/verify/aoj-cgl-7-e.test.cpp test/verify/aoj-cgl-7-h.test.cpp -test/verify/aoj-grl-3-a.test.cpp -test/verify/aoj-grl-3-b.test.cpp -test/verify/aoj-grl-3-c.test.cpp test/verify/aoj-grl-5-a-3.test.cpp test/verify/aoj-grl-5-a.test.cpp test/verify/aoj-grl-5-c-2.test.cpp diff --git a/test/verify/aoj-grl-3-a.test.cpp b/test/verify/aoj-grl-3-a.test.cpp index 6a7e30d58..8f9f3e468 100644 --- a/test/verify/aoj-grl-3-a.test.cpp +++ b/test/verify/aoj-grl-3-a.test.cpp @@ -1,17 +1,21 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_3_A +// clang-format on -#include "../../template/template.hpp" +#include +#include #include "../../graph/others/low-link.hpp" +using namespace std; + int main() { int V, E; cin >> V >> E; LowLink<> g(V); g.read(E, 0); g.build(); - auto &art = g.articulation; + auto& art = g.articulation; sort(art.begin(), art.end()); - for(auto &v : art) cout << v << "\n"; + for (auto& v : art) cout << v << "\n"; } - diff --git a/test/verify/aoj-grl-3-b.test.cpp b/test/verify/aoj-grl-3-b.test.cpp index cda52149e..a373e97f8 100644 --- a/test/verify/aoj-grl-3-b.test.cpp +++ b/test/verify/aoj-grl-3-b.test.cpp @@ -1,17 +1,24 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_3_B +// clang-format on -#include "../../template/template.hpp" +#include +#include +#include #include "../../graph/others/low-link.hpp" +using namespace std; + int main() { int V, E; cin >> V >> E; LowLink<> g(V); g.read(E, 0); g.build(); - auto &bridge = g.bridge; - for(auto &v : bridge) tie(v.from, v.to) = minmax({v.from, v.to}); - sort(bridge.begin(), bridge.end(), [](auto &p, auto &q) { return tie(p.from, p.to) < tie(q.from, q.to); }); - for(auto &v : bridge) cout << v.from << " " << v.to << "\n"; + auto& bridge = g.bridge; + for (auto& v : bridge) tie(v.from, v.to) = minmax({v.from, v.to}); + sort(bridge.begin(), bridge.end(), + [](auto& p, auto& q) { return tie(p.from, p.to) < tie(q.from, q.to); }); + for (auto& v : bridge) cout << v.from << " " << v.to << "\n"; } diff --git a/test/verify/aoj-grl-3-c.test.cpp b/test/verify/aoj-grl-3-c.test.cpp index 0880218db..9f5a8ec58 100644 --- a/test/verify/aoj-grl-3-c.test.cpp +++ b/test/verify/aoj-grl-3-c.test.cpp @@ -1,9 +1,13 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_3_C +// clang-format on -#include "../../template/template.hpp" +#include #include "../../graph/connected-components/strongly-connected-components.hpp" +using namespace std; + int main() { int V, E, Q; cin >> V >> E; @@ -11,9 +15,9 @@ int main() { scc.read(E, false, 0, true); scc.build(); cin >> Q; - while(Q--) { + while (Q--) { int a, b; cin >> a >> b; - cout << (int) (scc[a] == scc[b]) << "\n"; + cout << static_cast(scc[a] == scc[b]) << "\n"; } } From 6ae564451d814136d57026cd7ad39369e8114e1e Mon Sep 17 00:00:00 2001 From: ei1333 Date: Mon, 10 Aug 2026 10:52:01 +0000 Subject: [PATCH 08/16] Migrate AOJ tree verification tests --- SELF_CONTAINED_HEADER_MIGRATION.md | 3 ++- scripts/verify-template-include-allowlist.txt | 6 ------ test/verify/aoj-grl-5-a-3.test.cpp | 15 ++++++++++----- test/verify/aoj-grl-5-a.test.cpp | 8 ++++++-- test/verify/aoj-grl-5-c-2.test.cpp | 14 +++++++++----- test/verify/aoj-grl-5-c-3.test.cpp | 14 +++++++++----- test/verify/aoj-grl-5-c-4.test.cpp | 14 +++++++++----- test/verify/aoj-grl-5-c.test.cpp | 14 +++++++++----- 8 files changed, 54 insertions(+), 34 deletions(-) diff --git a/SELF_CONTAINED_HEADER_MIGRATION.md b/SELF_CONTAINED_HEADER_MIGRATION.md index 0ec1152b0..86501c1d7 100644 --- a/SELF_CONTAINED_HEADER_MIGRATION.md +++ b/SELF_CONTAINED_HEADER_MIGRATION.md @@ -27,7 +27,7 @@ import と別名を意図的に提供する集約ヘッダーのため、自己 | ----------------------------------------- | -------- | ---- | | リポジトリ内の `.hpp` | 調査済み | 320 | | 自己完結化して継続検査しているヘッダー | 移行済み | 319 | -| `template/template.hpp` に依存する verify | 移行待ち | 213 | +| `template/template.hpp` に依存する verify | 移行待ち | 207 | 移行済みヘッダーの正本は [`scripts/self-contained-headers.txt`](scripts/self-contained-headers.txt)、 @@ -150,6 +150,7 @@ g++ -std=c++17 -fsyntax-only -x c++ -include ./path/to/header.hpp /dev/null | 2026-08-10 | AOJ GRL の最短路 verify 6件 | テンプレート依存を削除 | | 2026-08-10 | AOJ GRL の全域木 verify 5件 | テンプレート依存を削除 | | 2026-08-10 | AOJ GRL の連結性 verify 3件 | テンプレート依存を削除 | +| 2026-08-10 | AOJ GRL の木 verify 6件 | テンプレート依存を削除 | ## 次の候補 diff --git a/scripts/verify-template-include-allowlist.txt b/scripts/verify-template-include-allowlist.txt index b18a0d9d0..90a906537 100644 --- a/scripts/verify-template-include-allowlist.txt +++ b/scripts/verify-template-include-allowlist.txt @@ -55,12 +55,6 @@ test/verify/aoj-cgl-4-c.test.cpp test/verify/aoj-cgl-7-d.test.cpp test/verify/aoj-cgl-7-e.test.cpp test/verify/aoj-cgl-7-h.test.cpp -test/verify/aoj-grl-5-a-3.test.cpp -test/verify/aoj-grl-5-a.test.cpp -test/verify/aoj-grl-5-c-2.test.cpp -test/verify/aoj-grl-5-c-3.test.cpp -test/verify/aoj-grl-5-c-4.test.cpp -test/verify/aoj-grl-5-c.test.cpp test/verify/aoj-grl-6-a-2.test.cpp test/verify/aoj-grl-6-a-3.test.cpp test/verify/aoj-grl-6-a-4.test.cpp diff --git a/test/verify/aoj-grl-5-a-3.test.cpp b/test/verify/aoj-grl-5-a-3.test.cpp index 9c803a6b8..b12c9ff36 100644 --- a/test/verify/aoj-grl-5-a-3.test.cpp +++ b/test/verify/aoj-grl-5-a-3.test.cpp @@ -1,19 +1,24 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_5_A +// clang-format on + +#include -#include "../../template/template.hpp" #include "../../structure/dynamic-tree/diameter.hpp" #include "../../structure/dynamic-tree/dynamic-tree-builder-for-edge.hpp" +using namespace std; + int main() { int N; cin >> N; - DynamicTreeBuilderForEdge< TopTree, Diameter< int64 > > g(N); - for(int i = 0; i < N; i++) { + DynamicTreeBuilderForEdge > g(N); + for (int i = 0; i < N; i++) { g.set_vertex(i, {true, 0}); } - for(int i = 1; i < N; i++) { + for (int i = 1; i < N; i++) { int a, b; - int64 w; + long long w; cin >> a >> b >> w; g.add_edge(a, b, {false, w}); } diff --git a/test/verify/aoj-grl-5-a.test.cpp b/test/verify/aoj-grl-5-a.test.cpp index d05780eef..c98fe5762 100644 --- a/test/verify/aoj-grl-5-a.test.cpp +++ b/test/verify/aoj-grl-5-a.test.cpp @@ -1,13 +1,17 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_5_A +// clang-format on -#include "../../template/template.hpp" +#include #include "../../graph/tree/tree-diameter.hpp" +using namespace std; + int main() { int N; cin >> N; - TreeDiameter< int > g(N); + TreeDiameter g(N); g.read(N - 1, 0, true); cout << g.build() << endl; } diff --git a/test/verify/aoj-grl-5-c-2.test.cpp b/test/verify/aoj-grl-5-c-2.test.cpp index 677407737..0de9cad39 100644 --- a/test/verify/aoj-grl-5-c-2.test.cpp +++ b/test/verify/aoj-grl-5-c-2.test.cpp @@ -1,17 +1,21 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_5_C +// clang-format on -#include "../../template/template.hpp" +#include #include "../../graph/tree/heavy-light-decomposition.hpp" +using namespace std; + int main() { int N, Q; cin >> N; - HeavyLightDecomposition< int > hld(N); - for(int i = 0; i < N; i++) { + HeavyLightDecomposition hld(N); + for (int i = 0; i < N; i++) { int k; cin >> k; - for(int j = 0; j < k; j++) { + for (int j = 0; j < k; j++) { int c; cin >> c; hld.add_edge(i, c); @@ -19,7 +23,7 @@ int main() { } hld.build(); cin >> Q; - for(int i = 0; i < Q; i++) { + for (int i = 0; i < Q; i++) { int u, v; cin >> u >> v; cout << hld.lca(u, v) << "\n"; diff --git a/test/verify/aoj-grl-5-c-3.test.cpp b/test/verify/aoj-grl-5-c-3.test.cpp index 7062aeb6b..63ab7adc8 100644 --- a/test/verify/aoj-grl-5-c-3.test.cpp +++ b/test/verify/aoj-grl-5-c-3.test.cpp @@ -1,17 +1,21 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_5_C +// clang-format on -#include "../../template/template.hpp" +#include #include "../../graph/tree/rmq-lowest-common-ancestor.hpp" +using namespace std; + int main() { int N, Q; cin >> N; - RMQLowestCommonAncestor< int > lca(N); - for(int i = 0; i < N; i++) { + RMQLowestCommonAncestor lca(N); + for (int i = 0; i < N; i++) { int k; cin >> k; - for(int j = 0; j < k; j++) { + for (int j = 0; j < k; j++) { int c; cin >> c; lca.add_edge(i, c); @@ -19,7 +23,7 @@ int main() { } lca.build(); cin >> Q; - for(int i = 0; i < Q; i++) { + for (int i = 0; i < Q; i++) { int u, v; cin >> u >> v; cout << lca.lca(u, v) << "\n"; diff --git a/test/verify/aoj-grl-5-c-4.test.cpp b/test/verify/aoj-grl-5-c-4.test.cpp index 4af9364ab..d8379f48f 100644 --- a/test/verify/aoj-grl-5-c-4.test.cpp +++ b/test/verify/aoj-grl-5-c-4.test.cpp @@ -1,17 +1,21 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_5_C +// clang-format on -#include "../../template/template.hpp" +#include #include "../../graph/tree/pmormq-lowest-common-ancestor.hpp" +using namespace std; + int main() { int N, Q; cin >> N; - PMORMQLowestCommonAncestor< int > dlca(N); - for(int i = 0; i < N; i++) { + PMORMQLowestCommonAncestor dlca(N); + for (int i = 0; i < N; i++) { int k; cin >> k; - for(int j = 0; j < k; j++) { + for (int j = 0; j < k; j++) { int c; cin >> c; dlca.add_edge(i, c); @@ -19,7 +23,7 @@ int main() { } dlca.build(); cin >> Q; - for(int i = 0; i < Q; i++) { + for (int i = 0; i < Q; i++) { int u, v; cin >> u >> v; cout << dlca.lca(u, v) << "\n"; diff --git a/test/verify/aoj-grl-5-c.test.cpp b/test/verify/aoj-grl-5-c.test.cpp index 9945e0be3..2588aac13 100644 --- a/test/verify/aoj-grl-5-c.test.cpp +++ b/test/verify/aoj-grl-5-c.test.cpp @@ -1,17 +1,21 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_5_C +// clang-format on -#include "../../template/template.hpp" +#include #include "../../graph/tree/doubling-lowest-common-ancestor.hpp" +using namespace std; + int main() { int N, Q; cin >> N; - DoublingLowestCommonAncestor< int > dlca(N); - for(int i = 0; i < N; i++) { + DoublingLowestCommonAncestor dlca(N); + for (int i = 0; i < N; i++) { int k; cin >> k; - for(int j = 0; j < k; j++) { + for (int j = 0; j < k; j++) { int c; cin >> c; dlca.add_edge(i, c); @@ -19,7 +23,7 @@ int main() { } dlca.build(); cin >> Q; - for(int i = 0; i < Q; i++) { + for (int i = 0; i < Q; i++) { int u, v; cin >> u >> v; cout << dlca.lca(u, v) << "\n"; From dffcab4814663b5fcece42af24ab8cc073c9ca9c Mon Sep 17 00:00:00 2001 From: ei1333 Date: Mon, 10 Aug 2026 10:53:15 +0000 Subject: [PATCH 09/16] Migrate AOJ flow verification tests --- SELF_CONTAINED_HEADER_MIGRATION.md | 3 ++- scripts/verify-template-include-allowlist.txt | 6 ------ test/verify/aoj-grl-6-a-2.test.cpp | 10 +++++++--- test/verify/aoj-grl-6-a-3.test.cpp | 10 +++++++--- test/verify/aoj-grl-6-a-4.test.cpp | 10 +++++++--- test/verify/aoj-grl-6-a.test.cpp | 10 +++++++--- test/verify/aoj-grl-6-b.test.cpp | 10 +++++++--- test/verify/aoj-grl-7-a.test.cpp | 8 ++++++-- 8 files changed, 43 insertions(+), 24 deletions(-) diff --git a/SELF_CONTAINED_HEADER_MIGRATION.md b/SELF_CONTAINED_HEADER_MIGRATION.md index 86501c1d7..9cc63ebb6 100644 --- a/SELF_CONTAINED_HEADER_MIGRATION.md +++ b/SELF_CONTAINED_HEADER_MIGRATION.md @@ -27,7 +27,7 @@ import と別名を意図的に提供する集約ヘッダーのため、自己 | ----------------------------------------- | -------- | ---- | | リポジトリ内の `.hpp` | 調査済み | 320 | | 自己完結化して継続検査しているヘッダー | 移行済み | 319 | -| `template/template.hpp` に依存する verify | 移行待ち | 207 | +| `template/template.hpp` に依存する verify | 移行待ち | 201 | 移行済みヘッダーの正本は [`scripts/self-contained-headers.txt`](scripts/self-contained-headers.txt)、 @@ -151,6 +151,7 @@ g++ -std=c++17 -fsyntax-only -x c++ -include ./path/to/header.hpp /dev/null | 2026-08-10 | AOJ GRL の全域木 verify 5件 | テンプレート依存を削除 | | 2026-08-10 | AOJ GRL の連結性 verify 3件 | テンプレート依存を削除 | | 2026-08-10 | AOJ GRL の木 verify 6件 | テンプレート依存を削除 | +| 2026-08-10 | AOJ GRL のフロー verify 6件 | テンプレート依存を削除 | ## 次の候補 diff --git a/scripts/verify-template-include-allowlist.txt b/scripts/verify-template-include-allowlist.txt index 90a906537..8de8a85b0 100644 --- a/scripts/verify-template-include-allowlist.txt +++ b/scripts/verify-template-include-allowlist.txt @@ -55,12 +55,6 @@ test/verify/aoj-cgl-4-c.test.cpp test/verify/aoj-cgl-7-d.test.cpp test/verify/aoj-cgl-7-e.test.cpp test/verify/aoj-cgl-7-h.test.cpp -test/verify/aoj-grl-6-a-2.test.cpp -test/verify/aoj-grl-6-a-3.test.cpp -test/verify/aoj-grl-6-a-4.test.cpp -test/verify/aoj-grl-6-a.test.cpp -test/verify/aoj-grl-6-b.test.cpp -test/verify/aoj-grl-7-a.test.cpp test/verify/aoj-itp1-3-d.test.cpp test/verify/aoj-ntl-1-a.test.cpp test/verify/aoj-ntl-1-b.test.cpp diff --git a/test/verify/aoj-grl-6-a-2.test.cpp b/test/verify/aoj-grl-6-a-2.test.cpp index d5e267f1c..d09f15852 100644 --- a/test/verify/aoj-grl-6-a-2.test.cpp +++ b/test/verify/aoj-grl-6-a-2.test.cpp @@ -1,14 +1,18 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_6_A +// clang-format on -#include "../../template/template.hpp" +#include #include "../../graph/flow/ford-fulkerson.hpp" +using namespace std; + int main() { int V, E; scanf("%d %d", &V, &E); - FordFulkerson< int > g(V); - for(int i = 0; i < E; i++) { + FordFulkerson g(V); + for (int i = 0; i < E; i++) { int a, b, c; scanf("%d %d %d", &a, &b, &c); g.add_edge(a, b, c); diff --git a/test/verify/aoj-grl-6-a-3.test.cpp b/test/verify/aoj-grl-6-a-3.test.cpp index 0038864ca..dfe5cfd8d 100644 --- a/test/verify/aoj-grl-6-a-3.test.cpp +++ b/test/verify/aoj-grl-6-a-3.test.cpp @@ -1,14 +1,18 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_6_A +// clang-format on -#include "../../template/template.hpp" +#include #include "../../graph/flow/push-relabel.hpp" +using namespace std; + int main() { int V, E; scanf("%d %d", &V, &E); - PushRelabel< int > g(V); - for(int i = 0; i < E; i++) { + PushRelabel g(V); + for (int i = 0; i < E; i++) { int a, b, c; scanf("%d %d %d", &a, &b, &c); g.add_edge(a, b, c); diff --git a/test/verify/aoj-grl-6-a-4.test.cpp b/test/verify/aoj-grl-6-a-4.test.cpp index 27e4ae53f..51b4a179c 100644 --- a/test/verify/aoj-grl-6-a-4.test.cpp +++ b/test/verify/aoj-grl-6-a-4.test.cpp @@ -1,14 +1,18 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_6_A +// clang-format on -#include "../../template/template.hpp" +#include #include "../../graph/flow/dinic-capacity-scaling.hpp" +using namespace std; + int main() { int V, E; scanf("%d %d", &V, &E); - DinicCapacityScaling< int > g(V); - for(int i = 0; i < E; i++) { + DinicCapacityScaling g(V); + for (int i = 0; i < E; i++) { int a, b, c; scanf("%d %d %d", &a, &b, &c); g.add_edge(a, b, c); diff --git a/test/verify/aoj-grl-6-a.test.cpp b/test/verify/aoj-grl-6-a.test.cpp index 24a7baf14..3175a471c 100644 --- a/test/verify/aoj-grl-6-a.test.cpp +++ b/test/verify/aoj-grl-6-a.test.cpp @@ -1,14 +1,18 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_6_A +// clang-format on -#include "../../template/template.hpp" +#include #include "../../graph/flow/dinic.hpp" +using namespace std; + int main() { int V, E; scanf("%d %d", &V, &E); - Dinic< int > g(V); - for(int i = 0; i < E; i++) { + Dinic g(V); + for (int i = 0; i < E; i++) { int a, b, c; scanf("%d %d %d", &a, &b, &c); g.add_edge(a, b, c); diff --git a/test/verify/aoj-grl-6-b.test.cpp b/test/verify/aoj-grl-6-b.test.cpp index ffee34337..bff6e4747 100644 --- a/test/verify/aoj-grl-6-b.test.cpp +++ b/test/verify/aoj-grl-6-b.test.cpp @@ -1,14 +1,18 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_6_B +// clang-format on -#include "../../template/template.hpp" +#include #include "../../graph/flow/primal-dual.hpp" +using namespace std; + int main() { int V, E, F; scanf("%d %d %d", &V, &E, &F); - PrimalDual< int, int > g(V); - for(int i = 0; i < E; i++) { + PrimalDual g(V); + for (int i = 0; i < E; i++) { int a, b, c, d; scanf("%d %d %d %d", &a, &b, &c, &d); g.add_edge(a, b, c, d); diff --git a/test/verify/aoj-grl-7-a.test.cpp b/test/verify/aoj-grl-7-a.test.cpp index 8581ceccd..635377dbd 100644 --- a/test/verify/aoj-grl-7-a.test.cpp +++ b/test/verify/aoj-grl-7-a.test.cpp @@ -1,14 +1,18 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_7_A +// clang-format on -#include "../../template/template.hpp" +#include #include "../../graph/flow/bipartite-matching.hpp" +using namespace std; + int main() { int X, Y, E; scanf("%d %d %d", &X, &Y, &E); BipartiteMatching bm(X + Y); - for(int i = 0; i < E; i++) { + for (int i = 0; i < E; i++) { int a, b; scanf("%d %d", &a, &b); bm.add_edge(a, X + b); From cec5361899240e792d82f01ecf06d03122daebcc Mon Sep 17 00:00:00 2001 From: ei1333 Date: Mon, 10 Aug 2026 10:54:28 +0000 Subject: [PATCH 10/16] Migrate AOJ number theory verification tests --- SELF_CONTAINED_HEADER_MIGRATION.md | 3 ++- scripts/verify-template-include-allowlist.txt | 5 ----- test/verify/aoj-itp1-3-d.test.cpp | 8 ++++++-- test/verify/aoj-ntl-1-a.test.cpp | 10 +++++++--- test/verify/aoj-ntl-1-b.test.cpp | 10 +++++++--- test/verify/aoj-ntl-1-d.test.cpp | 8 ++++++-- test/verify/aoj-ntl-1-e.test.cpp | 6 +++++- 7 files changed, 33 insertions(+), 17 deletions(-) diff --git a/SELF_CONTAINED_HEADER_MIGRATION.md b/SELF_CONTAINED_HEADER_MIGRATION.md index 9cc63ebb6..a7e894fd2 100644 --- a/SELF_CONTAINED_HEADER_MIGRATION.md +++ b/SELF_CONTAINED_HEADER_MIGRATION.md @@ -27,7 +27,7 @@ import と別名を意図的に提供する集約ヘッダーのため、自己 | ----------------------------------------- | -------- | ---- | | リポジトリ内の `.hpp` | 調査済み | 320 | | 自己完結化して継続検査しているヘッダー | 移行済み | 319 | -| `template/template.hpp` に依存する verify | 移行待ち | 201 | +| `template/template.hpp` に依存する verify | 移行待ち | 196 | 移行済みヘッダーの正本は [`scripts/self-contained-headers.txt`](scripts/self-contained-headers.txt)、 @@ -152,6 +152,7 @@ g++ -std=c++17 -fsyntax-only -x c++ -include ./path/to/header.hpp /dev/null | 2026-08-10 | AOJ GRL の連結性 verify 3件 | テンプレート依存を削除 | | 2026-08-10 | AOJ GRL の木 verify 6件 | テンプレート依存を削除 | | 2026-08-10 | AOJ GRL のフロー verify 6件 | テンプレート依存を削除 | +| 2026-08-10 | AOJ の基礎数論 verify 5件 | テンプレート依存を削除 | ## 次の候補 diff --git a/scripts/verify-template-include-allowlist.txt b/scripts/verify-template-include-allowlist.txt index 8de8a85b0..b71c2770c 100644 --- a/scripts/verify-template-include-allowlist.txt +++ b/scripts/verify-template-include-allowlist.txt @@ -55,11 +55,6 @@ test/verify/aoj-cgl-4-c.test.cpp test/verify/aoj-cgl-7-d.test.cpp test/verify/aoj-cgl-7-e.test.cpp test/verify/aoj-cgl-7-h.test.cpp -test/verify/aoj-itp1-3-d.test.cpp -test/verify/aoj-ntl-1-a.test.cpp -test/verify/aoj-ntl-1-b.test.cpp -test/verify/aoj-ntl-1-d.test.cpp -test/verify/aoj-ntl-1-e.test.cpp test/verify/yosupo-area-of-union-of-rectangles.test.cpp test/verify/yosupo-assignment.test.cpp test/verify/yosupo-bernoulli-number.test.cpp diff --git a/test/verify/aoj-itp1-3-d.test.cpp b/test/verify/aoj-itp1-3-d.test.cpp index 13673a85b..4122c4bf4 100644 --- a/test/verify/aoj-itp1-3-d.test.cpp +++ b/test/verify/aoj-itp1-3-d.test.cpp @@ -1,14 +1,18 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_3_D +// clang-format on -#include "../../template/template.hpp" +#include #include "../../math/number-theory/divisor.hpp" +using namespace std; + int main() { int A, B, C; cin >> A >> B >> C; int ret = 0; - for(auto &p : divisor(C)) { + for (auto& p : divisor(C)) { ret += A <= p and p <= B; } cout << ret << "\n"; diff --git a/test/verify/aoj-ntl-1-a.test.cpp b/test/verify/aoj-ntl-1-a.test.cpp index 515f567fa..c5bed3ad1 100644 --- a/test/verify/aoj-ntl-1-a.test.cpp +++ b/test/verify/aoj-ntl-1-a.test.cpp @@ -1,15 +1,19 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_1_A +// clang-format on -#include "../../template/template.hpp" +#include #include "../../math/number-theory/prime-factor.hpp" +using namespace std; + int main() { int N; cin >> N; cout << N << ":"; - for(auto p : prime_factor(N)) { - while(p.second--) cout << " " << p.first; + for (auto p : prime_factor(N)) { + while (p.second--) cout << " " << p.first; } cout << endl; } diff --git a/test/verify/aoj-ntl-1-b.test.cpp b/test/verify/aoj-ntl-1-b.test.cpp index 830c5fda8..01c82d7e0 100644 --- a/test/verify/aoj-ntl-1-b.test.cpp +++ b/test/verify/aoj-ntl-1-b.test.cpp @@ -1,11 +1,15 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_1_B +// clang-format on -#include "../../template/template.hpp" +#include #include "../../math/combinatorics/mod-pow.hpp" +using namespace std; + int main() { - int64 M, N; + long long M, N; cin >> M >> N; - cout << mod_pow(M, N, (int64)(1e9 + 7)) << endl; + cout << mod_pow(M, N, 1000000007LL) << endl; } diff --git a/test/verify/aoj-ntl-1-d.test.cpp b/test/verify/aoj-ntl-1-d.test.cpp index a352cb6e6..e6545a29c 100644 --- a/test/verify/aoj-ntl-1-d.test.cpp +++ b/test/verify/aoj-ntl-1-d.test.cpp @@ -1,11 +1,15 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_1_D +// clang-format on -#include "../../template/template.hpp" +#include #include "../../math/number-theory/euler-phi.hpp" +using namespace std; + int main() { int N; cin >> N; - cout << euler_phi< int64_t >(N) << endl; + cout << euler_phi(N) << endl; } diff --git a/test/verify/aoj-ntl-1-e.test.cpp b/test/verify/aoj-ntl-1-e.test.cpp index 5f13e04d5..cf9109168 100644 --- a/test/verify/aoj-ntl-1-e.test.cpp +++ b/test/verify/aoj-ntl-1-e.test.cpp @@ -1,9 +1,13 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_1_E +// clang-format on -#include "../../template/template.hpp" +#include #include "../../math/number-theory/extgcd.hpp" +using namespace std; + int main() { int a, b, x, y; cin >> a >> b; From 765db8436d94da0d51d6f1a03deb3e52ded71981 Mon Sep 17 00:00:00 2001 From: ei1333 Date: Mon, 10 Aug 2026 10:55:59 +0000 Subject: [PATCH 11/16] Migrate AOJ ALDS verification tests --- SELF_CONTAINED_HEADER_MIGRATION.md | 3 ++- scripts/verify-template-include-allowlist.txt | 6 ------ test/verify/aoj-alds-1-1-c-2.test.cpp | 8 ++++++-- test/verify/aoj-alds-1-1-c.test.cpp | 9 ++++++--- test/verify/aoj-alds-1-11-c.test.cpp | 19 ++++++++++++------- test/verify/aoj-alds-1-14-b.test.cpp | 11 ++++++++--- test/verify/aoj-alds-1-14-d.test.cpp | 9 +++++++-- test/verify/aoj-alds-1-9-c.test.cpp | 13 +++++++++---- 8 files changed, 50 insertions(+), 28 deletions(-) diff --git a/SELF_CONTAINED_HEADER_MIGRATION.md b/SELF_CONTAINED_HEADER_MIGRATION.md index a7e894fd2..0606dc3bf 100644 --- a/SELF_CONTAINED_HEADER_MIGRATION.md +++ b/SELF_CONTAINED_HEADER_MIGRATION.md @@ -27,7 +27,7 @@ import と別名を意図的に提供する集約ヘッダーのため、自己 | ----------------------------------------- | -------- | ---- | | リポジトリ内の `.hpp` | 調査済み | 320 | | 自己完結化して継続検査しているヘッダー | 移行済み | 319 | -| `template/template.hpp` に依存する verify | 移行待ち | 196 | +| `template/template.hpp` に依存する verify | 移行待ち | 190 | 移行済みヘッダーの正本は [`scripts/self-contained-headers.txt`](scripts/self-contained-headers.txt)、 @@ -153,6 +153,7 @@ g++ -std=c++17 -fsyntax-only -x c++ -include ./path/to/header.hpp /dev/null | 2026-08-10 | AOJ GRL の木 verify 6件 | テンプレート依存を削除 | | 2026-08-10 | AOJ GRL のフロー verify 6件 | テンプレート依存を削除 | | 2026-08-10 | AOJ の基礎数論 verify 5件 | テンプレート依存を削除 | +| 2026-08-10 | AOJ ALDS の verify 6件 | テンプレート依存を削除 | ## 次の候補 diff --git a/scripts/verify-template-include-allowlist.txt b/scripts/verify-template-include-allowlist.txt index b71c2770c..78504f9df 100644 --- a/scripts/verify-template-include-allowlist.txt +++ b/scripts/verify-template-include-allowlist.txt @@ -33,12 +33,6 @@ test/verify/aoj-2821.test.cpp test/verify/aoj-3022.test.cpp test/verify/aoj-3139.test.cpp test/verify/aoj-3198.test.cpp -test/verify/aoj-alds-1-1-c-2.test.cpp -test/verify/aoj-alds-1-1-c.test.cpp -test/verify/aoj-alds-1-11-c.test.cpp -test/verify/aoj-alds-1-14-b.test.cpp -test/verify/aoj-alds-1-14-d.test.cpp -test/verify/aoj-alds-1-9-c.test.cpp test/verify/aoj-cgl-1-a.test.cpp test/verify/aoj-cgl-1-b.test.cpp test/verify/aoj-cgl-1-c.test.cpp diff --git a/test/verify/aoj-alds-1-1-c-2.test.cpp b/test/verify/aoj-alds-1-1-c-2.test.cpp index e5a368a3e..9c01e295e 100644 --- a/test/verify/aoj-alds-1-1-c-2.test.cpp +++ b/test/verify/aoj-alds-1-1-c-2.test.cpp @@ -1,15 +1,19 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_C +// clang-format on -#include "../../template/template.hpp" +#include #include "../../math/number-theory/prime-table.hpp" +using namespace std; + int main() { auto t = prime_table(100000000); int N; cin >> N; int ret = 0; - while(N--) { + while (N--) { int x; cin >> x; ret += t[x]; diff --git a/test/verify/aoj-alds-1-1-c.test.cpp b/test/verify/aoj-alds-1-1-c.test.cpp index 637bc68ba..47f972b7c 100644 --- a/test/verify/aoj-alds-1-1-c.test.cpp +++ b/test/verify/aoj-alds-1-1-c.test.cpp @@ -1,18 +1,21 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_1_C +// clang-format on -#include "../../template/template.hpp" +#include #include "../../math/number-theory/is-prime.hpp" +using namespace std; + int main() { int N; cin >> N; int ret = 0; - while(N--) { + while (N--) { int x; cin >> x; ret += is_prime(x); } cout << ret << endl; } - diff --git a/test/verify/aoj-alds-1-11-c.test.cpp b/test/verify/aoj-alds-1-11-c.test.cpp index 935f826cd..e67f62ecb 100644 --- a/test/verify/aoj-alds-1-11-c.test.cpp +++ b/test/verify/aoj-alds-1-11-c.test.cpp @@ -1,19 +1,23 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_11_C +// clang-format on -#include "../../template/template.hpp" +#include +#include #include "../../graph/shortest-path/bfs.hpp" +using namespace std; int main() { int N; cin >> N; Graph<> g(N); - for(int i = 0; i < N; i++) { + for (int i = 0; i < N; i++) { int U, K; cin >> U >> K; --U; - for(int j = 0; j < K; j++) { + for (int j = 0; j < K; j++) { int x; cin >> x; --x; @@ -21,10 +25,11 @@ int main() { } } auto d = bfs(g, 0); - for(int i = 0; i < N; i++) { + for (int i = 0; i < N; i++) { cout << i + 1 << " "; - if(d[i] == numeric_limits< int >::max()) cout << -1 << "\n"; - else cout << d[i] << "\n"; + if (d[i] == numeric_limits::max()) + cout << -1 << "\n"; + else + cout << d[i] << "\n"; } } - diff --git a/test/verify/aoj-alds-1-14-b.test.cpp b/test/verify/aoj-alds-1-14-b.test.cpp index 1ce5a271b..a58725731 100644 --- a/test/verify/aoj-alds-1-14-b.test.cpp +++ b/test/verify/aoj-alds-1-14-b.test.cpp @@ -1,16 +1,21 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_14_B +// clang-format on -#include "../../template/template.hpp" +#include +#include #include "../../string/rolling-hash.hpp" +using namespace std; + int main() { string T, P; cin >> T; cin >> P; RollingHash rh1(T), rh2(P); - for(int i = 0; i + P.size() <= T.size(); i++) { - if(rh1.get(i, i + P.size()) == rh2.get(0, P.size())) { + for (int i = 0; i + P.size() <= T.size(); i++) { + if (rh1.get(i, i + P.size()) == rh2.get(0, P.size())) { cout << i << endl; } } diff --git a/test/verify/aoj-alds-1-14-d.test.cpp b/test/verify/aoj-alds-1-14-d.test.cpp index 701251846..195f752f7 100644 --- a/test/verify/aoj-alds-1-14-d.test.cpp +++ b/test/verify/aoj-alds-1-14-d.test.cpp @@ -1,9 +1,14 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_14_D +// clang-format on -#include "../../template/template.hpp" +#include +#include #include "../../string/suffix-array.hpp" +using namespace std; + int main() { string S; int Q; @@ -11,7 +16,7 @@ int main() { cin >> S; SuffixArray sa(S); cin >> Q; - while(Q--) { + while (Q--) { string T; cin >> T; auto range = sa.equal_range(T); diff --git a/test/verify/aoj-alds-1-9-c.test.cpp b/test/verify/aoj-alds-1-9-c.test.cpp index 2bffa294b..74244dfb8 100644 --- a/test/verify/aoj-alds-1-9-c.test.cpp +++ b/test/verify/aoj-alds-1-9-c.test.cpp @@ -1,15 +1,20 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_9_C +// clang-format on -#include "../../template/template.hpp" +#include +#include #include "../../structure/heap/leftist-heap.hpp" +using namespace std; + int main() { string s; - LeftistHeap< int, false > que; + LeftistHeap que; auto root = que.make_root(); - while(cin >> s, s != "end") { - if(s == "insert") { + while (cin >> s, s != "end") { + if (s == "insert") { int x; cin >> x; root = que.push(root, x); From fd9e3d5a6a21655a061d86d07b97978903c9629d Mon Sep 17 00:00:00 2001 From: ei1333 Date: Mon, 10 Aug 2026 10:57:54 +0000 Subject: [PATCH 12/16] Migrate AOJ geometry verification tests --- SELF_CONTAINED_HEADER_MIGRATION.md | 3 ++- scripts/verify-template-include-allowlist.txt | 16 ------------- test/verify/aoj-cgl-1-a.test.cpp | 9 +++++-- test/verify/aoj-cgl-1-b.test.cpp | 9 +++++-- test/verify/aoj-cgl-1-c.test.cpp | 24 +++++++++++++------ test/verify/aoj-cgl-2-a.test.cpp | 20 +++++++++++----- test/verify/aoj-cgl-2-b.test.cpp | 9 +++++-- test/verify/aoj-cgl-2-c.test.cpp | 9 +++++-- test/verify/aoj-cgl-2-d.test.cpp | 9 +++++-- test/verify/aoj-cgl-3-a.test.cpp | 9 +++++-- test/verify/aoj-cgl-3-b.test.cpp | 9 +++++-- test/verify/aoj-cgl-3-c.test.cpp | 11 ++++++--- test/verify/aoj-cgl-4-a.test.cpp | 17 ++++++++----- test/verify/aoj-cgl-4-b.test.cpp | 10 ++++++-- test/verify/aoj-cgl-4-c.test.cpp | 13 ++++++---- test/verify/aoj-cgl-7-d.test.cpp | 14 +++++++---- test/verify/aoj-cgl-7-e.test.cpp | 12 +++++++--- test/verify/aoj-cgl-7-h.test.cpp | 9 +++++-- 18 files changed, 144 insertions(+), 68 deletions(-) diff --git a/SELF_CONTAINED_HEADER_MIGRATION.md b/SELF_CONTAINED_HEADER_MIGRATION.md index 0606dc3bf..0646c21a0 100644 --- a/SELF_CONTAINED_HEADER_MIGRATION.md +++ b/SELF_CONTAINED_HEADER_MIGRATION.md @@ -27,7 +27,7 @@ import と別名を意図的に提供する集約ヘッダーのため、自己 | ----------------------------------------- | -------- | ---- | | リポジトリ内の `.hpp` | 調査済み | 320 | | 自己完結化して継続検査しているヘッダー | 移行済み | 319 | -| `template/template.hpp` に依存する verify | 移行待ち | 190 | +| `template/template.hpp` に依存する verify | 移行待ち | 174 | 移行済みヘッダーの正本は [`scripts/self-contained-headers.txt`](scripts/self-contained-headers.txt)、 @@ -154,6 +154,7 @@ g++ -std=c++17 -fsyntax-only -x c++ -include ./path/to/header.hpp /dev/null | 2026-08-10 | AOJ GRL のフロー verify 6件 | テンプレート依存を削除 | | 2026-08-10 | AOJ の基礎数論 verify 5件 | テンプレート依存を削除 | | 2026-08-10 | AOJ ALDS の verify 6件 | テンプレート依存を削除 | +| 2026-08-10 | AOJ CGL の verify 16件 | 出力精度を維持して依存を削除 | ## 次の候補 diff --git a/scripts/verify-template-include-allowlist.txt b/scripts/verify-template-include-allowlist.txt index 78504f9df..a00c7d3ff 100644 --- a/scripts/verify-template-include-allowlist.txt +++ b/scripts/verify-template-include-allowlist.txt @@ -33,22 +33,6 @@ test/verify/aoj-2821.test.cpp test/verify/aoj-3022.test.cpp test/verify/aoj-3139.test.cpp test/verify/aoj-3198.test.cpp -test/verify/aoj-cgl-1-a.test.cpp -test/verify/aoj-cgl-1-b.test.cpp -test/verify/aoj-cgl-1-c.test.cpp -test/verify/aoj-cgl-2-a.test.cpp -test/verify/aoj-cgl-2-b.test.cpp -test/verify/aoj-cgl-2-c.test.cpp -test/verify/aoj-cgl-2-d.test.cpp -test/verify/aoj-cgl-3-a.test.cpp -test/verify/aoj-cgl-3-b.test.cpp -test/verify/aoj-cgl-3-c.test.cpp -test/verify/aoj-cgl-4-a.test.cpp -test/verify/aoj-cgl-4-b.test.cpp -test/verify/aoj-cgl-4-c.test.cpp -test/verify/aoj-cgl-7-d.test.cpp -test/verify/aoj-cgl-7-e.test.cpp -test/verify/aoj-cgl-7-h.test.cpp test/verify/yosupo-area-of-union-of-rectangles.test.cpp test/verify/yosupo-assignment.test.cpp test/verify/yosupo-bernoulli-number.test.cpp diff --git a/test/verify/aoj-cgl-1-a.test.cpp b/test/verify/aoj-cgl-1-a.test.cpp index 1083bcf8f..a350bdc9b 100644 --- a/test/verify/aoj-cgl-1-a.test.cpp +++ b/test/verify/aoj-cgl-1-a.test.cpp @@ -1,18 +1,23 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_A +// clang-format on // competitive-verifier: ERROR 0.00000001 -#include "../../template/template.hpp" +#include +#include #include "../../geometry/projection.hpp" +using namespace std; using namespace geometry; int main() { + cout << fixed << setprecision(10); Line l; cin >> l; int Q; cin >> Q; - while(Q--) { + while (Q--) { Point p; cin >> p; cout << projection(l, p) << "\n"; diff --git a/test/verify/aoj-cgl-1-b.test.cpp b/test/verify/aoj-cgl-1-b.test.cpp index 184a105e2..09dfe519f 100644 --- a/test/verify/aoj-cgl-1-b.test.cpp +++ b/test/verify/aoj-cgl-1-b.test.cpp @@ -1,18 +1,23 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_B +// clang-format on // competitive-verifier: ERROR 0.00000001 -#include "../../template/template.hpp" +#include +#include #include "../../geometry/reflection.hpp" +using namespace std; using namespace geometry; int main() { + cout << fixed << setprecision(10); Line l; cin >> l; int Q; cin >> Q; - while(Q--) { + while (Q--) { Point p; cin >> p; cout << reflection(l, p) << "\n"; diff --git a/test/verify/aoj-cgl-1-c.test.cpp b/test/verify/aoj-cgl-1-c.test.cpp index 6a912b0b5..6a0b63e70 100644 --- a/test/verify/aoj-cgl-1-c.test.cpp +++ b/test/verify/aoj-cgl-1-c.test.cpp @@ -1,24 +1,34 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_C +// clang-format on -#include "../../template/template.hpp" +#include +#include #include "../../geometry/ccw.hpp" +using namespace std; using namespace geometry; int main() { + cout << fixed << setprecision(10); Point p1, p2; cin >> p1 >> p2; int Q; cin >> Q; - while(Q--) { + while (Q--) { Point p3; cin >> p3; auto t = ccw(p1, p2, p3); - if(t == 1) cout << "COUNTER_CLOCKWISE\n"; - else if(t == -1) cout << "CLOCKWISE\n"; - else if(t == 2) cout << "ONLINE_BACK\n"; - else if(t == -2) cout << "ONLINE_FRONT\n"; - else cout << "ON_SEGMENT\n"; + if (t == 1) + cout << "COUNTER_CLOCKWISE\n"; + else if (t == -1) + cout << "CLOCKWISE\n"; + else if (t == 2) + cout << "ONLINE_BACK\n"; + else if (t == -2) + cout << "ONLINE_FRONT\n"; + else + cout << "ON_SEGMENT\n"; } } diff --git a/test/verify/aoj-cgl-2-a.test.cpp b/test/verify/aoj-cgl-2-a.test.cpp index e72530b9a..85099cac5 100644 --- a/test/verify/aoj-cgl-2-a.test.cpp +++ b/test/verify/aoj-cgl-2-a.test.cpp @@ -1,20 +1,28 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_A +// clang-format on -#include "../../template/template.hpp" +#include +#include -#include "../../geometry/is_parallel.hpp" #include "../../geometry/is_orthogonal.hpp" +#include "../../geometry/is_parallel.hpp" +using namespace std; using namespace geometry; int main() { + cout << fixed << setprecision(10); int Q; cin >> Q; - while(Q--) { + while (Q--) { Line s1, s2; cin >> s1 >> s2; - if(is_parallel(s1, s2)) cout << "2\n"; - else if(is_orthogonal(s1, s2)) cout << "1\n"; - else cout << "0\n"; + if (is_parallel(s1, s2)) + cout << "2\n"; + else if (is_orthogonal(s1, s2)) + cout << "1\n"; + else + cout << "0\n"; } } diff --git a/test/verify/aoj-cgl-2-b.test.cpp b/test/verify/aoj-cgl-2-b.test.cpp index e4c8552ee..c09f87c67 100644 --- a/test/verify/aoj-cgl-2-b.test.cpp +++ b/test/verify/aoj-cgl-2-b.test.cpp @@ -1,15 +1,20 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_B +// clang-format on -#include "../../template/template.hpp" +#include +#include #include "../../geometry/is_intersect_ss.hpp" +using namespace std; using namespace geometry; int main() { + cout << fixed << setprecision(10); int T; cin >> T; - while(T--) { + while (T--) { Segment a, b; cin >> a >> b; cout << is_intersect_ss(a, b) << "\n"; diff --git a/test/verify/aoj-cgl-2-c.test.cpp b/test/verify/aoj-cgl-2-c.test.cpp index 0cd170749..c868a4494 100644 --- a/test/verify/aoj-cgl-2-c.test.cpp +++ b/test/verify/aoj-cgl-2-c.test.cpp @@ -1,16 +1,21 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_C +// clang-format on // competitive-verifier: ERROR 0.00000001 -#include "../../template/template.hpp" +#include +#include #include "../../geometry/cross_point_ll.hpp" +using namespace std; using namespace geometry; int main() { + cout << fixed << setprecision(10); int T; cin >> T; - while(T--) { + while (T--) { Line a, b; cin >> a >> b; cout << cross_point_ll(a, b) << "\n"; diff --git a/test/verify/aoj-cgl-2-d.test.cpp b/test/verify/aoj-cgl-2-d.test.cpp index f008d6185..97a42e00a 100644 --- a/test/verify/aoj-cgl-2-d.test.cpp +++ b/test/verify/aoj-cgl-2-d.test.cpp @@ -1,16 +1,21 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_D +// clang-format on // competitive-verifier: ERROR 0.00000001 -#include "../../template/template.hpp" +#include +#include #include "../../geometry/distance_ss.hpp" +using namespace std; using namespace geometry; int main() { + cout << fixed << setprecision(10); int T; cin >> T; - while(T--) { + while (T--) { Segment a, b; cin >> a >> b; cout << distance_ss(a, b) << "\n"; diff --git a/test/verify/aoj-cgl-3-a.test.cpp b/test/verify/aoj-cgl-3-a.test.cpp index 9c2a2addb..15fdd6978 100644 --- a/test/verify/aoj-cgl-3-a.test.cpp +++ b/test/verify/aoj-cgl-3-a.test.cpp @@ -1,15 +1,20 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_3_A +// clang-format on -#include "../../template/template.hpp" +#include +#include #include "../../geometry/area.hpp" +using namespace std; using namespace geometry; int main() { + cout << fixed << setprecision(10); int N; cin >> N; Polygon p(N); - for(auto &s : p) cin >> s; + for (auto& s : p) cin >> s; cout << fixed << setprecision(1) << area(p) << "\n"; } diff --git a/test/verify/aoj-cgl-3-b.test.cpp b/test/verify/aoj-cgl-3-b.test.cpp index 0a02f2e6a..88af1ac03 100644 --- a/test/verify/aoj-cgl-3-b.test.cpp +++ b/test/verify/aoj-cgl-3-b.test.cpp @@ -1,15 +1,20 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_3_B +// clang-format on -#include "../../template/template.hpp" +#include +#include #include "../../geometry/is_convex_polygon.hpp" +using namespace std; using namespace geometry; int main() { + cout << fixed << setprecision(10); int N; cin >> N; Polygon p(N); - for(auto &s : p) cin >> s; + for (auto& s : p) cin >> s; cout << is_convex_polygon(p) << endl; } diff --git a/test/verify/aoj-cgl-3-c.test.cpp b/test/verify/aoj-cgl-3-c.test.cpp index 4264144e7..31e617eea 100644 --- a/test/verify/aoj-cgl-3-c.test.cpp +++ b/test/verify/aoj-cgl-3-c.test.cpp @@ -1,21 +1,26 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_3_C +// clang-format on -#include "../../template/template.hpp" +#include +#include #include "../../geometry/contains.hpp" +using namespace std; using namespace geometry; int main() { + cout << fixed << setprecision(10); int N; cin >> N; Polygon p(N); - for(int i = 0; i < N; i++) { + for (int i = 0; i < N; i++) { cin >> p[i]; } int Q; cin >> Q; - while(Q--) { + while (Q--) { Point q; cin >> q; cout << contains(p, q) << "\n"; diff --git a/test/verify/aoj-cgl-4-a.test.cpp b/test/verify/aoj-cgl-4-a.test.cpp index b988e7f5c..6926e07bf 100644 --- a/test/verify/aoj-cgl-4-a.test.cpp +++ b/test/verify/aoj-cgl-4-a.test.cpp @@ -1,26 +1,31 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_4_A +// clang-format on -#include "../../template/template.hpp" +#include +#include #include "../../geometry/convex_hull.hpp" +using namespace std; using namespace geometry; int main() { + cout << fixed << setprecision(10); int N; cin >> N; Polygon p(N); - for(auto &s : p) cin >> s; + for (auto& s : p) cin >> s; p = convex_hull(p, false); - N = (int) p.size(); + N = (int)p.size(); cout << N << "\n"; int idx = 0; - for(int i = 1; i < N; i++) { - if(compare_y(p[i], p[idx])) { + for (int i = 1; i < N; i++) { + if (compare_y(p[i], p[idx])) { idx = i; } } - for(int i = 0; i < N; i++) { + for (int i = 0; i < N; i++) { cout << fixed << setprecision(0) << p[(idx + i) % N] << "\n"; } } diff --git a/test/verify/aoj-cgl-4-b.test.cpp b/test/verify/aoj-cgl-4-b.test.cpp index 3844bc6ba..9d88dffb2 100644 --- a/test/verify/aoj-cgl-4-b.test.cpp +++ b/test/verify/aoj-cgl-4-b.test.cpp @@ -1,17 +1,23 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_4_B +// clang-format on // competitive-verifier: ERROR 0.00000001 -#include "../../template/template.hpp" +#include +#include +#include #include "../../geometry/convex_polygon_diameter.hpp" +using namespace std; using namespace geometry; int main() { + cout << fixed << setprecision(10); int N; cin >> N; Polygon p(N); - for(int i = 0; i < N; i++) { + for (int i = 0; i < N; i++) { cin >> p[i]; } auto ret = convex_polygon_diameter(p); diff --git a/test/verify/aoj-cgl-4-c.test.cpp b/test/verify/aoj-cgl-4-c.test.cpp index cddfb58ff..98cd94222 100644 --- a/test/verify/aoj-cgl-4-c.test.cpp +++ b/test/verify/aoj-cgl-4-c.test.cpp @@ -1,23 +1,28 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_4_C +// clang-format on // competitive-verifier: ERROR 0.00001 -#include "../../template/template.hpp" +#include +#include -#include "../../geometry/convex_polygon_cut.hpp" #include "../../geometry/area.hpp" +#include "../../geometry/convex_polygon_cut.hpp" +using namespace std; using namespace geometry; int main() { + cout << fixed << setprecision(10); int n; cin >> n; Polygon poly(n); - for(auto &p : poly) { + for (auto& p : poly) { cin >> p; } int q; cin >> q; - while(q--) { + while (q--) { Line l; cin >> l; cout << area(convex_polygon_cut(poly, l)) << "\n"; diff --git a/test/verify/aoj-cgl-7-d.test.cpp b/test/verify/aoj-cgl-7-d.test.cpp index 03fa8e34a..c5f1629a7 100644 --- a/test/verify/aoj-cgl-7-d.test.cpp +++ b/test/verify/aoj-cgl-7-d.test.cpp @@ -1,23 +1,29 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_D +// clang-format on // competitive-verifier: ERROR 0.000001 -#include "../../template/template.hpp" +#include +#include +#include #include "../../geometry/cross_point_cl.hpp" +using namespace std; using namespace geometry; int main() { + cout << fixed << setprecision(10); Circle c; cin >> c.p >> c.r; int Q; cin >> Q; - while(Q--) { + while (Q--) { Line l; cin >> l; auto ret = cross_point_cl(c, l); - if(ret.size() == 1) ret.emplace_back(ret[0]); - if(!compare_x(ret[0], ret[1])) swap(ret[0], ret[1]); + if (ret.size() == 1) ret.emplace_back(ret[0]); + if (!compare_x(ret[0], ret[1])) swap(ret[0], ret[1]); cout << ret[0] << " " << ret[1] << "\n"; } } diff --git a/test/verify/aoj-cgl-7-e.test.cpp b/test/verify/aoj-cgl-7-e.test.cpp index 4fcc5975c..d9ac7c39a 100644 --- a/test/verify/aoj-cgl-7-e.test.cpp +++ b/test/verify/aoj-cgl-7-e.test.cpp @@ -1,17 +1,23 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_E +// clang-format on // competitive-verifier: ERROR 0.000001 -#include "../../template/template.hpp" +#include +#include +#include #include "../../geometry/cross_point_cc.hpp" +using namespace std; using namespace geometry; int main() { + cout << fixed << setprecision(10); Circle x, y; cin >> x.p >> x.r >> y.p >> y.r; auto ret = cross_point_cc(x, y); - if(ret.size() == 1) ret.emplace_back(ret[0]); - if(!compare_x(ret[0], ret[1])) swap(ret[0], ret[1]); + if (ret.size() == 1) ret.emplace_back(ret[0]); + if (!compare_x(ret[0], ret[1])) swap(ret[0], ret[1]); cout << ret[0] << " " << ret[1] << "\n"; } diff --git a/test/verify/aoj-cgl-7-h.test.cpp b/test/verify/aoj-cgl-7-h.test.cpp index 27e575d53..7547ecb04 100644 --- a/test/verify/aoj-cgl-7-h.test.cpp +++ b/test/verify/aoj-cgl-7-h.test.cpp @@ -1,18 +1,23 @@ +// clang-format off // competitive-verifier: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_7_H +// clang-format on // competitive-verifier: ERROR 0.00001 -#include "../../template/template.hpp" +#include +#include #include "../../geometry/common_area_cp.hpp" +using namespace std; using namespace geometry; int main() { + cout << fixed << setprecision(10); int N; Real R; cin >> N >> R; Circle c(Point(0, 0), R); Polygon p(N); - for(auto &s : p) cin >> s; + for (auto& s : p) cin >> s; cout << common_area_cp(c, p) << endl; } From 3cbb719f041cd6f1eccc15e0e5b20a20d1f12774 Mon Sep 17 00:00:00 2001 From: ei1333 Date: Mon, 10 Aug 2026 10:59:37 +0000 Subject: [PATCH 13/16] Migrate static RMQ verification tests --- SELF_CONTAINED_HEADER_MIGRATION.md | 3 ++- scripts/verify-template-include-allowlist.txt | 6 ----- test/verify/yosupo-staticrmq-2.test.cpp | 14 ++++++++---- test/verify/yosupo-staticrmq-3.test.cpp | 20 ++++++++++------- test/verify/yosupo-staticrmq-4.test.cpp | 22 +++++++++++-------- test/verify/yosupo-staticrmq-5.test.cpp | 14 +++++++----- test/verify/yosupo-staticrmq-6.test.cpp | 18 +++++++++------ test/verify/yosupo-staticrmq.test.cpp | 14 ++++++++---- 8 files changed, 67 insertions(+), 44 deletions(-) diff --git a/SELF_CONTAINED_HEADER_MIGRATION.md b/SELF_CONTAINED_HEADER_MIGRATION.md index 0646c21a0..5e7b8c184 100644 --- a/SELF_CONTAINED_HEADER_MIGRATION.md +++ b/SELF_CONTAINED_HEADER_MIGRATION.md @@ -27,7 +27,7 @@ import と別名を意図的に提供する集約ヘッダーのため、自己 | ----------------------------------------- | -------- | ---- | | リポジトリ内の `.hpp` | 調査済み | 320 | | 自己完結化して継続検査しているヘッダー | 移行済み | 319 | -| `template/template.hpp` に依存する verify | 移行待ち | 174 | +| `template/template.hpp` に依存する verify | 移行待ち | 168 | 移行済みヘッダーの正本は [`scripts/self-contained-headers.txt`](scripts/self-contained-headers.txt)、 @@ -155,6 +155,7 @@ g++ -std=c++17 -fsyntax-only -x c++ -include ./path/to/header.hpp /dev/null | 2026-08-10 | AOJ の基礎数論 verify 5件 | テンプレート依存を削除 | | 2026-08-10 | AOJ ALDS の verify 6件 | テンプレート依存を削除 | | 2026-08-10 | AOJ CGL の verify 16件 | 出力精度を維持して依存を削除 | +| 2026-08-10 | Library Checker Static RMQ の verify 6件 | テンプレート依存を削除 | ## 次の候補 diff --git a/scripts/verify-template-include-allowlist.txt b/scripts/verify-template-include-allowlist.txt index a00c7d3ff..4bc65997e 100644 --- a/scripts/verify-template-include-allowlist.txt +++ b/scripts/verify-template-include-allowlist.txt @@ -133,12 +133,6 @@ test/verify/yosupo-static-range-frequency.test.cpp test/verify/yosupo-static-range-inversions-query.test.cpp test/verify/yosupo-static-range-sum.test.cpp test/verify/yosupo-static-rectangle-add-rectangle-sum.test.cpp -test/verify/yosupo-staticrmq-2.test.cpp -test/verify/yosupo-staticrmq-3.test.cpp -test/verify/yosupo-staticrmq-4.test.cpp -test/verify/yosupo-staticrmq-5.test.cpp -test/verify/yosupo-staticrmq-6.test.cpp -test/verify/yosupo-staticrmq.test.cpp test/verify/yosupo-stirling-number-of-the-first-kind.test.cpp test/verify/yosupo-stirling-number-of-the-second-kind.test.cpp test/verify/yosupo-subset-convolution.test.cpp diff --git a/test/verify/yosupo-staticrmq-2.test.cpp b/test/verify/yosupo-staticrmq-2.test.cpp index 01569a88f..929b58131 100644 --- a/test/verify/yosupo-staticrmq-2.test.cpp +++ b/test/verify/yosupo-staticrmq-2.test.cpp @@ -1,17 +1,23 @@ +// clang-format off // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/staticrmq +// clang-format on -#include "../../template/template.hpp" +#include +#include +#include #include "../../structure/others/disjoint-sparse-table.hpp" +using namespace std; + int main() { int N, Q; cin >> N >> Q; - vector< int > A(N); - cin >> A; + vector A(N); + for (int& a : A) cin >> a; auto f = [](int a, int b) { return min(a, b); }; auto st = get_disjoint_sparse_table(A, f); - while(Q--) { + while (Q--) { int l, r; cin >> l >> r; cout << st.fold(l, r) << "\n"; diff --git a/test/verify/yosupo-staticrmq-3.test.cpp b/test/verify/yosupo-staticrmq-3.test.cpp index 01df7ff29..246fa65e7 100644 --- a/test/verify/yosupo-staticrmq-3.test.cpp +++ b/test/verify/yosupo-staticrmq-3.test.cpp @@ -1,23 +1,27 @@ +// clang-format off // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/staticrmq +// clang-format on -#include "../../template/template.hpp" - -#include "../../other/vector-pool.hpp" +#include +#include +#include +#include #include "../../structure/bbst/red-black-tree.hpp" +using namespace std; + int main() { int N, Q; cin >> N >> Q; - vector< int > A(N); - cin >> A; + vector A(N); + for (int& a : A) cin >> a; auto f = [](int a, int b) { return min(a, b); }; - RedBlackTree< int, decltype(f) > rbt(2 * N, f, inf); + RedBlackTree rbt(2 * N, f, numeric_limits::max()); auto root = rbt.build(A); - while(Q--) { + while (Q--) { int l, r; cin >> l >> r; cout << rbt.query(root, l, r) << "\n"; } } - diff --git a/test/verify/yosupo-staticrmq-4.test.cpp b/test/verify/yosupo-staticrmq-4.test.cpp index 2ec6ddd94..5f6ca0dd0 100644 --- a/test/verify/yosupo-staticrmq-4.test.cpp +++ b/test/verify/yosupo-staticrmq-4.test.cpp @@ -1,28 +1,32 @@ +// clang-format off // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/staticrmq +// clang-format on -#include "../../template/template.hpp" +#include +#include -#include "../../graph/graph-template.hpp" -#include "../../graph/tree/pmormq-lowest-common-ancestor.hpp" #include "../../graph/others/cartesian-tree.hpp" +#include "../../graph/tree/pmormq-lowest-common-ancestor.hpp" + +using namespace std; int main() { int N, Q; cin >> N >> Q; - vector< int > A(N); - cin >> A; + vector A(N); + for (int& a : A) cin >> a; auto t = cartesian_tree(A); - PMORMQLowestCommonAncestor< int > g(N); + PMORMQLowestCommonAncestor g(N); int root = -1; - for(int i = 0; i < N; i++) { - if(t[i] == -1) { + for (int i = 0; i < N; i++) { + if (t[i] == -1) { root = i; continue; } g.add_directed_edge(t[i], i); } g.build(root); - while(Q--) { + while (Q--) { int l, r; cin >> l >> r; cout << A[g.lca(l, r - 1)] << "\n"; diff --git a/test/verify/yosupo-staticrmq-5.test.cpp b/test/verify/yosupo-staticrmq-5.test.cpp index 49c4f84db..179b7505e 100644 --- a/test/verify/yosupo-staticrmq-5.test.cpp +++ b/test/verify/yosupo-staticrmq-5.test.cpp @@ -1,22 +1,26 @@ +// clang-format off // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/staticrmq +// clang-format on -#include "../../template/template.hpp" +#include +#include +#include "../../other/printer.hpp" +#include "../../other/scanner.hpp" #include "../../structure/others/linear-rmq.hpp" -#include "../../other/scanner.hpp" -#include "../../other/printer.hpp" +using namespace std; int main() { Scanner in(stdin); Printer out(stdout); int N, Q; in.read(N, Q); - vector< int > A(N); + vector A(N); in.read(A); auto f = [&](int a, int b) { return A[a] < A[b]; }; auto seg = get_linear_rmq(N, f); - while(Q--) { + while (Q--) { int l, r; in.read(l, r); out.writeln(A[seg.fold(l, r)]); diff --git a/test/verify/yosupo-staticrmq-6.test.cpp b/test/verify/yosupo-staticrmq-6.test.cpp index 814ba7179..af0787a58 100644 --- a/test/verify/yosupo-staticrmq-6.test.cpp +++ b/test/verify/yosupo-staticrmq-6.test.cpp @@ -1,22 +1,26 @@ +// clang-format off // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/staticrmq +// clang-format on -#include "../../template/template.hpp" +#include +#include +#include #include "../../other/offline-rmq.hpp" - -#include "../../other/scanner.hpp" #include "../../other/printer.hpp" +#include "../../other/scanner.hpp" +using namespace std; int main() { Scanner in(stdin); Printer out(stdout); int N, Q; in.read(N, Q); - vector< int > A(N); + vector A(N); in.read(A); - vector< pair< int, int > > qs(Q); - for(auto&[l, r]: qs) in.read(l, r); + vector> qs(Q); + for (auto& [l, r] : qs) in.read(l, r); auto ans = offline_rmq(qs, [&](int a, int b) { return A[a] < A[b]; }); - for(int i = 0; i < Q; i++) out.writeln(A[ans[i]]); + for (int i = 0; i < Q; i++) out.writeln(A[ans[i]]); } diff --git a/test/verify/yosupo-staticrmq.test.cpp b/test/verify/yosupo-staticrmq.test.cpp index ae770a986..5be6ddd4d 100644 --- a/test/verify/yosupo-staticrmq.test.cpp +++ b/test/verify/yosupo-staticrmq.test.cpp @@ -1,16 +1,22 @@ +// clang-format off // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/staticrmq +// clang-format on -#include "../../template/template.hpp" +#include +#include +#include #include "../../structure/others/sparse-table.hpp" +using namespace std; + int main() { int N, Q; cin >> N >> Q; - vector< int > A(N); - cin >> A; + vector A(N); + for (int& a : A) cin >> a; auto st = get_sparse_table(A, [](int a, int b) { return min(a, b); }); - while(Q--) { + while (Q--) { int l, r; cin >> l >> r; cout << st.fold(l, r) << "\n"; From c2f34cead94b59b77227bd7577e17c60e4a881f9 Mon Sep 17 00:00:00 2001 From: ei1333 Date: Mon, 10 Aug 2026 11:00:59 +0000 Subject: [PATCH 14/16] Migrate LCA verification tests --- SELF_CONTAINED_HEADER_MIGRATION.md | 3 ++- scripts/verify-template-include-allowlist.txt | 4 ---- test/verify/yosupo-lca-2.test.cpp | 15 ++++++------- test/verify/yosupo-lca-3.test.cpp | 16 +++++++------- test/verify/yosupo-lca-4.test.cpp | 21 ++++++++++++------- test/verify/yosupo-lca.test.cpp | 15 ++++++------- 6 files changed, 40 insertions(+), 34 deletions(-) diff --git a/SELF_CONTAINED_HEADER_MIGRATION.md b/SELF_CONTAINED_HEADER_MIGRATION.md index 5e7b8c184..908e5d42f 100644 --- a/SELF_CONTAINED_HEADER_MIGRATION.md +++ b/SELF_CONTAINED_HEADER_MIGRATION.md @@ -27,7 +27,7 @@ import と別名を意図的に提供する集約ヘッダーのため、自己 | ----------------------------------------- | -------- | ---- | | リポジトリ内の `.hpp` | 調査済み | 320 | | 自己完結化して継続検査しているヘッダー | 移行済み | 319 | -| `template/template.hpp` に依存する verify | 移行待ち | 168 | +| `template/template.hpp` に依存する verify | 移行待ち | 164 | 移行済みヘッダーの正本は [`scripts/self-contained-headers.txt`](scripts/self-contained-headers.txt)、 @@ -156,6 +156,7 @@ g++ -std=c++17 -fsyntax-only -x c++ -include ./path/to/header.hpp /dev/null | 2026-08-10 | AOJ ALDS の verify 6件 | テンプレート依存を削除 | | 2026-08-10 | AOJ CGL の verify 16件 | 出力精度を維持して依存を削除 | | 2026-08-10 | Library Checker Static RMQ の verify 6件 | テンプレート依存を削除 | +| 2026-08-10 | Library Checker LCA の verify 4件 | テンプレート依存を削除 | ## 次の候補 diff --git a/scripts/verify-template-include-allowlist.txt b/scripts/verify-template-include-allowlist.txt index 4bc65997e..0bcb24207 100644 --- a/scripts/verify-template-include-allowlist.txt +++ b/scripts/verify-template-include-allowlist.txt @@ -75,10 +75,6 @@ test/verify/yosupo-inv-of-formal-power-series.test.cpp test/verify/yosupo-k-shortest-walk.test.cpp test/verify/yosupo-kth-root-integer.test.cpp test/verify/yosupo-kth-term-of-linearly-recurrent-sequence.test.cpp -test/verify/yosupo-lca-2.test.cpp -test/verify/yosupo-lca-3.test.cpp -test/verify/yosupo-lca-4.test.cpp -test/verify/yosupo-lca.test.cpp test/verify/yosupo-line-add-get-min-2.test.cpp test/verify/yosupo-line-add-get-min.test.cpp test/verify/yosupo-log-of-formal-power-series.test.cpp diff --git a/test/verify/yosupo-lca-2.test.cpp b/test/verify/yosupo-lca-2.test.cpp index b21e7b783..6e21215a2 100644 --- a/test/verify/yosupo-lca-2.test.cpp +++ b/test/verify/yosupo-lca-2.test.cpp @@ -1,27 +1,28 @@ +// clang-format off // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/lca +// clang-format on -#include "../../template/template.hpp" +#include -#include "../../graph/graph-template.hpp" #include "../../graph/tree/rmq-lowest-common-ancestor.hpp" - -#include "../../other/scanner.hpp" #include "../../other/printer.hpp" +#include "../../other/scanner.hpp" +using namespace std; int main() { Scanner in(stdin); Printer out(stdout); int N, Q; in.read(N, Q); - RMQLowestCommonAncestor< int > g(N); - for(int i = 1; i < N; i++) { + RMQLowestCommonAncestor g(N); + for (int i = 1; i < N; i++) { int x; in.read(x); g.add_directed_edge(x, i); } g.build(); - for(int i = 0; i < Q; i++) { + for (int i = 0; i < Q; i++) { int u, v; in.read(u, v); out.writeln(g.lca(u, v)); diff --git a/test/verify/yosupo-lca-3.test.cpp b/test/verify/yosupo-lca-3.test.cpp index 89cf34ca2..b9d79788b 100644 --- a/test/verify/yosupo-lca-3.test.cpp +++ b/test/verify/yosupo-lca-3.test.cpp @@ -1,26 +1,28 @@ +// clang-format off // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/lca +// clang-format on -#include "../../template/template.hpp" +#include -#include "../../graph/graph-template.hpp" #include "../../graph/tree/doubling-lowest-common-ancestor.hpp" - -#include "../../other/scanner.hpp" #include "../../other/printer.hpp" +#include "../../other/scanner.hpp" + +using namespace std; int main() { Scanner in(stdin); Printer out(stdout); int N, Q; in.read(N, Q); - DoublingLowestCommonAncestor< int > g(N); - for(int i = 1; i < N; i++) { + DoublingLowestCommonAncestor g(N); + for (int i = 1; i < N; i++) { int x; in.read(x); g.add_directed_edge(x, i); } g.build(); - for(int i = 0; i < Q; i++) { + for (int i = 0; i < Q; i++) { int u, v; in.read(u, v); out.writeln(g.lca(u, v)); diff --git a/test/verify/yosupo-lca-4.test.cpp b/test/verify/yosupo-lca-4.test.cpp index e54cc9b08..042a6f5c0 100644 --- a/test/verify/yosupo-lca-4.test.cpp +++ b/test/verify/yosupo-lca-4.test.cpp @@ -1,25 +1,30 @@ +// clang-format off // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/lca +// clang-format on -#include "../../template/template.hpp" +#include +#include +#include #include "../../graph/tree/offline-lca.hpp" - -#include "../../other/scanner.hpp" #include "../../other/printer.hpp" +#include "../../other/scanner.hpp" + +using namespace std; int main() { Scanner in(stdin); Printer out(stdout); int N, Q; in.read(N, Q); - Graph< int > g(N); - for(int i = 1; i < N; i++) { + Graph g(N); + for (int i = 1; i < N; i++) { int x; in.read(x); g.add_directed_edge(x, i); } - vector< pair< int, int > > qs(Q); - for(auto&[l, r]: qs) in.read(l, r); + vector> qs(Q); + for (auto& [l, r] : qs) in.read(l, r); auto ans = offline_lca(g, qs); - for(auto &p: ans) out.writeln(p); + for (auto& p : ans) out.writeln(p); } diff --git a/test/verify/yosupo-lca.test.cpp b/test/verify/yosupo-lca.test.cpp index f66068ffb..3853abb22 100644 --- a/test/verify/yosupo-lca.test.cpp +++ b/test/verify/yosupo-lca.test.cpp @@ -1,27 +1,28 @@ +// clang-format off // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/lca +// clang-format on -#include "../../template/template.hpp" +#include -#include "../../graph/graph-template.hpp" #include "../../graph/tree/pmormq-lowest-common-ancestor.hpp" - -#include "../../other/scanner.hpp" #include "../../other/printer.hpp" +#include "../../other/scanner.hpp" +using namespace std; int main() { Scanner in(stdin); Printer out(stdout); int N, Q; in.read(N, Q); - PMORMQLowestCommonAncestor< int > g(N); - for(int i = 1; i < N; i++) { + PMORMQLowestCommonAncestor g(N); + for (int i = 1; i < N; i++) { int x; in.read(x); g.add_directed_edge(x, i); } g.build(); - for(int i = 0; i < Q; i++) { + for (int i = 0; i < Q; i++) { int u, v; in.read(u, v); out.writeln(g.lca(u, v)); From 2da0f7945e4efe7ecd6226902b4859225280a541 Mon Sep 17 00:00:00 2001 From: ei1333 Date: Mon, 10 Aug 2026 11:02:14 +0000 Subject: [PATCH 15/16] Migrate range kth smallest verification tests --- SELF_CONTAINED_HEADER_MIGRATION.md | 3 +- scripts/verify-template-include-allowlist.txt | 3 -- .../yosupo-range-kth-smallest-2.test.cpp | 16 ++++--- .../yosupo-range-kth-smallest-3.test.cpp | 44 +++++++++++-------- .../verify/yosupo-range-kth-smallest.test.cpp | 15 ++++--- 5 files changed, 47 insertions(+), 34 deletions(-) diff --git a/SELF_CONTAINED_HEADER_MIGRATION.md b/SELF_CONTAINED_HEADER_MIGRATION.md index 908e5d42f..0f36c76c3 100644 --- a/SELF_CONTAINED_HEADER_MIGRATION.md +++ b/SELF_CONTAINED_HEADER_MIGRATION.md @@ -27,7 +27,7 @@ import と別名を意図的に提供する集約ヘッダーのため、自己 | ----------------------------------------- | -------- | ---- | | リポジトリ内の `.hpp` | 調査済み | 320 | | 自己完結化して継続検査しているヘッダー | 移行済み | 319 | -| `template/template.hpp` に依存する verify | 移行待ち | 164 | +| `template/template.hpp` に依存する verify | 移行待ち | 161 | 移行済みヘッダーの正本は [`scripts/self-contained-headers.txt`](scripts/self-contained-headers.txt)、 @@ -157,6 +157,7 @@ g++ -std=c++17 -fsyntax-only -x c++ -include ./path/to/header.hpp /dev/null | 2026-08-10 | AOJ CGL の verify 16件 | 出力精度を維持して依存を削除 | | 2026-08-10 | Library Checker Static RMQ の verify 6件 | テンプレート依存を削除 | | 2026-08-10 | Library Checker LCA の verify 4件 | テンプレート依存を削除 | +| 2026-08-10 | Library Checker Range Kth Smallest の verify 3件 | テンプレート依存を削除 | ## 次の候補 diff --git a/scripts/verify-template-include-allowlist.txt b/scripts/verify-template-include-allowlist.txt index 0bcb24207..757ce8aff 100644 --- a/scripts/verify-template-include-allowlist.txt +++ b/scripts/verify-template-include-allowlist.txt @@ -108,9 +108,6 @@ test/verify/yosupo-range-affine-range-sum-2.test.cpp test/verify/yosupo-range-affine-range-sum-3.test.cpp test/verify/yosupo-range-affine-range-sum.test.cpp test/verify/yosupo-range-chmin-chmax-add-range-sum.test.cpp -test/verify/yosupo-range-kth-smallest-2.test.cpp -test/verify/yosupo-range-kth-smallest-3.test.cpp -test/verify/yosupo-range-kth-smallest.test.cpp test/verify/yosupo-range-linear-add-range-min.test.cpp test/verify/yosupo-rectangle-add-point-get.test.cpp test/verify/yosupo-rectangle-sum-2.test.cpp diff --git a/test/verify/yosupo-range-kth-smallest-2.test.cpp b/test/verify/yosupo-range-kth-smallest-2.test.cpp index 96e61d794..9bb108e66 100644 --- a/test/verify/yosupo-range-kth-smallest-2.test.cpp +++ b/test/verify/yosupo-range-kth-smallest-2.test.cpp @@ -1,17 +1,21 @@ +// clang-format off // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/range_kth_smallest +// clang-format on -#include "../../template/template.hpp" +#include +#include -#include "../../structure/wavelet/succinct-indexable-dictionary.hpp" #include "../../structure/wavelet/wavelet-tree.hpp" +using namespace std; + int main() { int N, Q; cin >> N >> Q; - vector< int > A(N); - cin >> A; - CompressedWaveletTree< int, 18 > mat(A); - for(int i = 0; i < Q; i++) { + vector A(N); + for (int& a : A) cin >> a; + CompressedWaveletTree mat(A); + for (int i = 0; i < Q; i++) { int a, b, c; cin >> a >> b >> c; cout << mat.kth_smallest(a, b, c) << "\n"; diff --git a/test/verify/yosupo-range-kth-smallest-3.test.cpp b/test/verify/yosupo-range-kth-smallest-3.test.cpp index 2fe01c3a5..384c58acc 100644 --- a/test/verify/yosupo-range-kth-smallest-3.test.cpp +++ b/test/verify/yosupo-range-kth-smallest-3.test.cpp @@ -1,48 +1,54 @@ +// clang-format off // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/range_kth_smallest +// clang-format on -#include "../../template/template.hpp" +#include +#include +#include #include "../../structure/segment-tree/persistent-segment-tree.hpp" +using namespace std; + int main() { int N, Q; cin >> N >> Q; - vector< int > A(N); - for(auto& a : A) cin >> a; + vector A(N); + for (auto& a : A) cin >> a; auto xs = A; sort(xs.begin(), xs.end()); xs.erase(unique(xs.begin(), xs.end()), xs.end()); - auto f = [](int64 a, int64 b) { return a + b; }; + auto f = [](long long a, long long b) { return a + b; }; auto e = []() { return 0ll; }; auto monoid = LambdaMonoid(f, e); - PersistentSegmentTree segCnt(monoid, N); - vector< decltype(segCnt)::NP > cntNP(xs.size() + 1); - cntNP[0] = segCnt.build(vector< int64 >(N, 0ll)); + PersistentSegmentTree segCnt(monoid, N); + vector cntNP(xs.size() + 1); + cntNP[0] = segCnt.build(vector(N, 0ll)); - vector< vector< int > > upd(xs.size());; - for(int i = 0; i < N; i++) { + vector> upd(xs.size()); + for (int i = 0; i < N; i++) { A[i] = lower_bound(xs.begin(), xs.end(), A[i]) - xs.begin(); upd[A[i]].emplace_back(i); } - for(int i = 0; i < xs.size(); i++) { + for (int i = 0; i < static_cast(xs.size()); i++) { auto cntNow = cntNP[i]; - for(auto& j : upd[i]) { + for (auto& j : upd[i]) { cntNow = segCnt.set(cntNow, j, 1); } cntNP[i + 1] = cntNow; } - while(Q--) { + while (Q--) { int l, r, k; cin >> l >> r >> k; - int ok = -1, ng = (int) xs.size() - 1; - auto check = [&](int p) { - return segCnt.prod(cntNP[p + 1], l, r) <= k; - }; - while(ng - ok > 1) { + int ok = -1, ng = static_cast(xs.size()) - 1; + auto check = [&](int p) { return segCnt.prod(cntNP[p + 1], l, r) <= k; }; + while (ng - ok > 1) { int mid = (ok + ng) / 2; - if(check(mid)) ok = mid; - else ng = mid; + if (check(mid)) + ok = mid; + else + ng = mid; } cout << xs[ok + 1] << "\n"; } diff --git a/test/verify/yosupo-range-kth-smallest.test.cpp b/test/verify/yosupo-range-kth-smallest.test.cpp index ab033ddae..8e24c6773 100644 --- a/test/verify/yosupo-range-kth-smallest.test.cpp +++ b/test/verify/yosupo-range-kth-smallest.test.cpp @@ -1,16 +1,21 @@ +// clang-format off // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/range_kth_smallest +// clang-format on -#include "../../template/template.hpp" +#include +#include #include "../../structure/wavelet/wavelet-matrix.hpp" +using namespace std; + int main() { int N, Q; cin >> N >> Q; - vector< int > A(N); - cin >> A; - CompressedWaveletMatrix< int, 18 > mat(A); - for(int i = 0; i < Q; i++) { + vector A(N); + for (int& a : A) cin >> a; + CompressedWaveletMatrix mat(A); + for (int i = 0; i < Q; i++) { int a, b, c; cin >> a >> b >> c; cout << mat.kth_smallest(a, b, c) << "\n"; From 43aa6777611322f3ff5a32241f9b59e021c9be1b Mon Sep 17 00:00:00 2001 From: ei1333 Date: Mon, 10 Aug 2026 11:04:56 +0000 Subject: [PATCH 16/16] Migrate basic Library Checker verification tests --- SELF_CONTAINED_HEADER_MIGRATION.md | 3 ++- scripts/verify-template-include-allowlist.txt | 11 ----------- test/verify/yosupo-cartesian-tree.test.cpp | 19 +++++++++++++------ test/verify/yosupo-enumerate-primes.test.cpp | 17 +++++++++++++---- test/verify/yosupo-factorize.test.cpp | 18 ++++++++++++------ .../yosupo-persistent-unionfind.test.cpp | 13 +++++++++---- test/verify/yosupo-primality-test.test.cpp | 10 +++++++--- test/verify/yosupo-scc.test.cpp | 12 +++++++++--- test/verify/yosupo-set-xor-min.test.cpp | 18 +++++++++++------- test/verify/yosupo-static-range-sum.test.cpp | 12 ++++++++---- test/verify/yosupo-suffixarray.test.cpp | 13 +++++++++++-- test/verify/yosupo-tree-diameter.test.cpp | 12 +++++++++--- test/verify/yosupo-zalgorithm.test.cpp | 14 ++++++++++++-- 13 files changed, 116 insertions(+), 56 deletions(-) diff --git a/SELF_CONTAINED_HEADER_MIGRATION.md b/SELF_CONTAINED_HEADER_MIGRATION.md index 0f36c76c3..7715b4e7c 100644 --- a/SELF_CONTAINED_HEADER_MIGRATION.md +++ b/SELF_CONTAINED_HEADER_MIGRATION.md @@ -27,7 +27,7 @@ import と別名を意図的に提供する集約ヘッダーのため、自己 | ----------------------------------------- | -------- | ---- | | リポジトリ内の `.hpp` | 調査済み | 320 | | 自己完結化して継続検査しているヘッダー | 移行済み | 319 | -| `template/template.hpp` に依存する verify | 移行待ち | 161 | +| `template/template.hpp` に依存する verify | 移行待ち | 150 | 移行済みヘッダーの正本は [`scripts/self-contained-headers.txt`](scripts/self-contained-headers.txt)、 @@ -158,6 +158,7 @@ g++ -std=c++17 -fsyntax-only -x c++ -include ./path/to/header.hpp /dev/null | 2026-08-10 | Library Checker Static RMQ の verify 6件 | テンプレート依存を削除 | | 2026-08-10 | Library Checker LCA の verify 4件 | テンプレート依存を削除 | | 2026-08-10 | Library Checker Range Kth Smallest の verify 3件 | テンプレート依存を削除 | +| 2026-08-10 | Library Checker の基礎 verify 11件 | テンプレート依存を削除 | ## 次の候補 diff --git a/scripts/verify-template-include-allowlist.txt b/scripts/verify-template-include-allowlist.txt index 757ce8aff..fe6c5a027 100644 --- a/scripts/verify-template-include-allowlist.txt +++ b/scripts/verify-template-include-allowlist.txt @@ -42,7 +42,6 @@ test/verify/yosupo-bitwise-and-convolution-2.test.cpp test/verify/yosupo-bitwise-and-convolution-3.test.cpp test/verify/yosupo-bitwise-and-convolution.test.cpp test/verify/yosupo-bitwise-xor-convolution.test.cpp -test/verify/yosupo-cartesian-tree.test.cpp test/verify/yosupo-chromatic-number.test.cpp test/verify/yosupo-composition-of-formal-power-series-large.test.cpp test/verify/yosupo-compositional-inverse-of-formal-power-series-large.test.cpp @@ -62,11 +61,9 @@ test/verify/yosupo-dynamic-tree-vertex-add-subtree-sum-3.test.cpp test/verify/yosupo-dynamic-tree-vertex-set-path-composite-4.test.cpp test/verify/yosupo-eertree.test.cpp test/verify/yosupo-enumerate-palindromes.test.cpp -test/verify/yosupo-enumerate-primes.test.cpp test/verify/yosupo-enumerate-quotients.test.cpp test/verify/yosupo-enumerate-triangles.test.cpp test/verify/yosupo-exp-of-formal-power-series.test.cpp -test/verify/yosupo-factorize.test.cpp test/verify/yosupo-find-linear-recurrence.test.cpp test/verify/yosupo-frequency-table-of-tree-distance.test.cpp test/verify/yosupo-general-matching.test.cpp @@ -88,7 +85,6 @@ test/verify/yosupo-multipoint-evaluation.test.cpp test/verify/yosupo-number-of-increasing-sequences-between-two-sequences.test.cpp test/verify/yosupo-number-of-substrings.test.cpp test/verify/yosupo-partition-function.test.cpp -test/verify/yosupo-persistent-unionfind.test.cpp test/verify/yosupo-point-add-rectangle-sum-2.test.cpp test/verify/yosupo-point-add-rectangle-sum-3.test.cpp test/verify/yosupo-point-add-rectangle-sum-4.test.cpp @@ -101,7 +97,6 @@ test/verify/yosupo-point-set-tree-path-composite-sum.test.cpp test/verify/yosupo-polynomial-interpolation.test.cpp test/verify/yosupo-polynomial-taylor-shift.test.cpp test/verify/yosupo-pow-of-formal-power-series.test.cpp -test/verify/yosupo-primality-test.test.cpp test/verify/yosupo-queue-operate-all-composite.test.cpp test/verify/yosupo-range-affine-point-get.test.cpp test/verify/yosupo-range-affine-range-sum-2.test.cpp @@ -112,9 +107,7 @@ test/verify/yosupo-range-linear-add-range-min.test.cpp test/verify/yosupo-rectangle-add-point-get.test.cpp test/verify/yosupo-rectangle-sum-2.test.cpp test/verify/yosupo-rectangle-sum.test.cpp -test/verify/yosupo-scc.test.cpp test/verify/yosupo-segment-add-get-min.test.cpp -test/verify/yosupo-set-xor-min.test.cpp test/verify/yosupo-sharp-p-subset-sum.test.cpp test/verify/yosupo-shift-of-sampling-points-of-polynomial.test.cpp test/verify/yosupo-shortest-path.test.cpp @@ -124,22 +117,18 @@ test/verify/yosupo-sqrt-of-formal-power-series.test.cpp test/verify/yosupo-static-range-count-distinct.test.cpp test/verify/yosupo-static-range-frequency.test.cpp test/verify/yosupo-static-range-inversions-query.test.cpp -test/verify/yosupo-static-range-sum.test.cpp test/verify/yosupo-static-rectangle-add-rectangle-sum.test.cpp test/verify/yosupo-stirling-number-of-the-first-kind.test.cpp test/verify/yosupo-stirling-number-of-the-second-kind.test.cpp test/verify/yosupo-subset-convolution.test.cpp -test/verify/yosupo-suffixarray.test.cpp test/verify/yosupo-sum-of-floor-of-linear.test.cpp test/verify/yosupo-tetration-mod.test.cpp test/verify/yosupo-three-edge-connected-components.test.cpp test/verify/yosupo-tree-decomposition-width-2.test.cpp -test/verify/yosupo-tree-diameter.test.cpp test/verify/yosupo-two-edge-connected-components-2.test.cpp test/verify/yosupo-two-edge-connected-components.test.cpp test/verify/yosupo-two-sat.test.cpp test/verify/yosupo-wildcard-pattern-matching.test.cpp -test/verify/yosupo-zalgorithm.test.cpp test/verify/yukicoder-1002.test.cpp test/verify/yukicoder-1069.test.cpp test/verify/yukicoder-1236.test.cpp diff --git a/test/verify/yosupo-cartesian-tree.test.cpp b/test/verify/yosupo-cartesian-tree.test.cpp index d16313a4b..5ef95c397 100644 --- a/test/verify/yosupo-cartesian-tree.test.cpp +++ b/test/verify/yosupo-cartesian-tree.test.cpp @@ -1,18 +1,25 @@ +// clang-format off // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/cartesian_tree +// clang-format on -#include "../../template/template.hpp" +#include +#include #include "../../graph/others/cartesian-tree.hpp" +using namespace std; + int main() { int N; cin >> N; - vector< int > A(N); - for(auto &a : A) cin >> a; + vector A(N); + for (auto& a : A) cin >> a; auto p = cartesian_tree(A); - for(int i = 0; i < N; i++) { - if(p[i] >= 0) cout << p[i] << " "; - else cout << i << " "; + for (int i = 0; i < N; i++) { + if (p[i] >= 0) + cout << p[i] << " "; + else + cout << i << " "; } cout << "\n"; } diff --git a/test/verify/yosupo-enumerate-primes.test.cpp b/test/verify/yosupo-enumerate-primes.test.cpp index 28b72db9f..3e1419aee 100644 --- a/test/verify/yosupo-enumerate-primes.test.cpp +++ b/test/verify/yosupo-enumerate-primes.test.cpp @@ -1,17 +1,26 @@ +// clang-format off // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/enumerate_primes +// clang-format on -#include "../../template/template.hpp" +#include +#include #include "../../math/number-theory/enumerate-primes.hpp" +using namespace std; + int main() { int N, A, B; cin >> N >> A >> B; auto d = enumerate_primes(N); - vector< int > ans; - for(int i = B; i < d.size(); i += A) { + vector ans; + for (int i = B; i < static_cast(d.size()); i += A) { ans.emplace_back(d[i]); } cout << d.size() << " " << ans.size() << "\n"; - cout << ans << "\n"; + for (int i = 0; i < static_cast(ans.size()); i++) { + if (i > 0) cout << " "; + cout << ans[i]; + } + cout << "\n"; } diff --git a/test/verify/yosupo-factorize.test.cpp b/test/verify/yosupo-factorize.test.cpp index 663a679ab..747fcc6d1 100644 --- a/test/verify/yosupo-factorize.test.cpp +++ b/test/verify/yosupo-factorize.test.cpp @@ -1,18 +1,24 @@ +// clang-format off // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/factorize +// clang-format on -#include "../../template/template.hpp" +#include +#include #include "../../math/number-theory/fast-prime-factorization.hpp" +using namespace std; + int main() { int Q; cin >> Q; - while(Q--) { - int64 X; + while (Q--) { + long long X; cin >> X; auto ret = FastPrimeFactorization::prime_factor(X); - sort(begin(ret), end(ret)); - cout << ret.size() << " "; - cout << ret << "\n"; + sort(ret.begin(), ret.end()); + cout << ret.size(); + for (auto factor : ret) cout << " " << factor; + cout << "\n"; } } diff --git a/test/verify/yosupo-persistent-unionfind.test.cpp b/test/verify/yosupo-persistent-unionfind.test.cpp index aaf59297d..b316fc2a1 100644 --- a/test/verify/yosupo-persistent-unionfind.test.cpp +++ b/test/verify/yosupo-persistent-unionfind.test.cpp @@ -1,19 +1,24 @@ +// clang-format off // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/persistent_unionfind +// clang-format on -#include "../../template/template.hpp" +#include +#include #include "../../structure/union-find/persistent-union-find.hpp" +using namespace std; + int main() { int N, Q; cin >> N >> Q; - vector< PersistentUnionFind > uf(Q + 1); + vector uf(Q + 1); uf[0] = PersistentUnionFind(N); - for(int i = 1; i <= Q; i++) { + for (int i = 1; i <= Q; i++) { int t, k, u, v; cin >> t >> k >> u >> v; ++k; - if(t == 0) { + if (t == 0) { uf[i] = uf[k]; uf[i].unite(u, v); } else { diff --git a/test/verify/yosupo-primality-test.test.cpp b/test/verify/yosupo-primality-test.test.cpp index 28c124059..db869efb1 100644 --- a/test/verify/yosupo-primality-test.test.cpp +++ b/test/verify/yosupo-primality-test.test.cpp @@ -1,14 +1,18 @@ +// clang-format off // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/primality_test +// clang-format on -#include "../../template/template.hpp" +#include #include "../../math/number-theory/fast-prime-factorization.hpp" +using namespace std; + int main() { int Q; cin >> Q; - while(Q--) { - int64 N; + while (Q--) { + long long N; cin >> N; cout << (FastPrimeFactorization::is_prime(N) ? "Yes" : "No") << "\n"; } diff --git a/test/verify/yosupo-scc.test.cpp b/test/verify/yosupo-scc.test.cpp index 32b77ae22..3a0ff7258 100644 --- a/test/verify/yosupo-scc.test.cpp +++ b/test/verify/yosupo-scc.test.cpp @@ -1,9 +1,13 @@ +// clang-format off // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/scc +// clang-format on -#include "../../template/template.hpp" +#include #include "../../graph/connected-components/strongly-connected-components.hpp" +using namespace std; + int main() { int N, M; cin >> N >> M; @@ -11,7 +15,9 @@ int main() { g.read(M, 0, false, true); g.build(); cout << g.group.size() << "\n"; - for(auto &p : g.group) { - cout << p.size() << " " << p << "\n"; + for (auto& p : g.group) { + cout << p.size(); + for (int v : p) cout << " " << v; + cout << "\n"; } } diff --git a/test/verify/yosupo-set-xor-min.test.cpp b/test/verify/yosupo-set-xor-min.test.cpp index e296ee963..011b768bd 100644 --- a/test/verify/yosupo-set-xor-min.test.cpp +++ b/test/verify/yosupo-set-xor-min.test.cpp @@ -1,20 +1,24 @@ +// clang-format off // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/set_xor_min +// clang-format on -#include "../../template/template.hpp" +#include #include "../../structure/trie/binary-trie.hpp" +using namespace std; + int main() { int Q; cin >> Q; - BinaryTrie< int, 29 > trie; - for(int i = 0; i < Q; i++) { + BinaryTrie trie; + for (int i = 0; i < Q; i++) { int t, x; cin >> t >> x; - if(t == 0) { - if(trie.count(x) == 0) trie.add(x); - } else if(t == 1) { - if(trie.count(x) != 0) trie.erase(x); + if (t == 0) { + if (trie.count(x) == 0) trie.add(x); + } else if (t == 1) { + if (trie.count(x) != 0) trie.erase(x); } else { cout << trie.min_element(x).first << "\n"; } diff --git a/test/verify/yosupo-static-range-sum.test.cpp b/test/verify/yosupo-static-range-sum.test.cpp index 07aac288c..a9dc010c7 100644 --- a/test/verify/yosupo-static-range-sum.test.cpp +++ b/test/verify/yosupo-static-range-sum.test.cpp @@ -1,20 +1,24 @@ +// clang-format off // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/static_range_sum +// clang-format on -#include "../../template/template.hpp" +#include #include "../../dp/cumulative-sum.hpp" +using namespace std; + int main() { int n, q; cin >> n >> q; - CumulativeSum< int64 > cs(n); - for(int i = 0; i < n; i++) { + CumulativeSum cs(n); + for (int i = 0; i < n; i++) { int x; cin >> x; cs.add(i, x); } cs.build(); - for(int i = 0; i < q; i++) { + for (int i = 0; i < q; i++) { int l, r; cin >> l >> r; cout << cs.fold(l, r) << "\n"; diff --git a/test/verify/yosupo-suffixarray.test.cpp b/test/verify/yosupo-suffixarray.test.cpp index 999c14744..78f0cb90a 100644 --- a/test/verify/yosupo-suffixarray.test.cpp +++ b/test/verify/yosupo-suffixarray.test.cpp @@ -1,13 +1,22 @@ +// clang-format off // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/suffixarray +// clang-format on -#include "../../template/template.hpp" +#include +#include #include "../../string/suffix-array.hpp" +using namespace std; + int main() { string s; cin >> s; auto sa = SuffixArray(s); sa.erase(sa.begin()); - cout << sa << "\n"; + for (int i = 0; i < static_cast(sa.size()); i++) { + if (i > 0) cout << " "; + cout << sa[i]; + } + cout << "\n"; } diff --git a/test/verify/yosupo-tree-diameter.test.cpp b/test/verify/yosupo-tree-diameter.test.cpp index c15fae5ce..7bedac042 100644 --- a/test/verify/yosupo-tree-diameter.test.cpp +++ b/test/verify/yosupo-tree-diameter.test.cpp @@ -1,15 +1,21 @@ +// clang-format off // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/tree_diameter +// clang-format on -#include "../../template/template.hpp" +#include #include "../../graph/tree/tree-diameter.hpp" +using namespace std; + int main() { int N; cin >> N; - TreeDiameter< int64_t > g(N); + TreeDiameter g(N); g.read(N - 1, 0, true); cout << g.build() << " "; cout << g.path.size() + 1 << "\n"; - cout << g.path[0].from << " " << g.path << "\n"; + cout << g.path[0].from; + for (auto& edge : g.path) cout << " " << edge.to; + cout << "\n"; } diff --git a/test/verify/yosupo-zalgorithm.test.cpp b/test/verify/yosupo-zalgorithm.test.cpp index 84b15301e..fd8d33717 100644 --- a/test/verify/yosupo-zalgorithm.test.cpp +++ b/test/verify/yosupo-zalgorithm.test.cpp @@ -1,11 +1,21 @@ +// clang-format off // competitive-verifier: PROBLEM https://judge.yosupo.jp/problem/zalgorithm +// clang-format on -#include "../../template/template.hpp" +#include +#include #include "../../string/z-algorithm.hpp" +using namespace std; + int main() { string s; cin >> s; - cout << ZAlgorithm(s).get() << "\n"; + auto z = ZAlgorithm(s).get(); + for (int i = 0; i < static_cast(z.size()); i++) { + if (i > 0) cout << " "; + cout << z[i]; + } + cout << "\n"; }