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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions .github/workflows/programming_team_code_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
sudo apt install -y wget software-properties-common
wget -O - https://apt.llvm.org/llvm.sh | sudo bash
- name: Install dependencies
run: sudo apt update && sudo apt install -y clang-format-18 cppcheck
run: sudo apt update && sudo apt install -y clang-format-19 cppcheck
- name: checks format then lints
run: make --directory=tests/ check_format_lint

Expand All @@ -53,7 +53,7 @@ jobs:
sudo apt install -y wget software-properties-common
wget -O - https://apt.llvm.org/llvm.sh | sudo bash
- name: Install dependencies
run: sudo apt update && sudo apt install -y clang-tidy-18
run: sudo apt update && sudo apt install -y clang-tidy-19
- name: clang-tidy
run: make --directory=tests/ clangtidy

Expand All @@ -68,8 +68,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up LLVM repository
run: wget -qO- https://apt.llvm.org/llvm.sh | sudo bash -s -- 19
- name: Install dependencies
run: wget -qO- https://apt.llvm.org/llvm.sh | sudo bash -s -- 18
run: sudo apt update && sudo apt install -y clang-19
- name: Compile all tests
run: make --directory=tests/ compile_clang

Expand All @@ -88,10 +90,11 @@ jobs:
run: |
sudo apt update
sudo apt install texlive texlive-latex-extra rename nodejs npm
wget -qO- https://apt.llvm.org/llvm.sh | sudo bash -s -- 18
wget -qO- https://apt.llvm.org/llvm.sh | sudo bash -s -- 19
sudo apt update && sudo apt install -y clang-19
- name: build ptc
run: make --directory=tests/ ptc
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: ptc
path: tests/ptc.pdf
Expand All @@ -102,7 +105,7 @@ jobs:
if: github.ref == 'refs/heads/dev' && github.event_name == 'push'
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: ptc
path: tests/ptc.pdf
Expand All @@ -126,7 +129,7 @@ jobs:
sudo apt install -y wget software-properties-common
wget -O - https://apt.llvm.org/llvm.sh | sudo bash
- name: Install dependencies
run: sudo apt update && sudo apt install -y clang-format-18
run: sudo apt update && sudo apt install -y clang-format-19
- name: Combine includes and force push to main branch
run: |
git config --local user.name github-actions
Expand Down
24 changes: 0 additions & 24 deletions library/contest/dynamic_bitset.hpp

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ template<class DS, class... ARGS> struct pq_updates {
vector<upd> extra;
int idx = sz(upd_st) - 1, lowest_pri = INT_MAX;
for (auto it = rbegin(mp);
2 * sz(extra) < sz(upd_st) - idx; it++) {
2 * sz(extra) < sz(upd_st) - idx; it++) {
auto [pri, idx_sk] = *it;
extra.push_back(upd_st[idx_sk]);
idx = min(idx, idx_sk), lowest_pri = pri;
Expand Down
2 changes: 1 addition & 1 deletion library/loops/chooses.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
//! @time O(n choose k)
//! @space O(1)
for (int mask = (1 << k) - 1; mask < (1 << n);
mask = next_subset(mask))
mask = next_subset(mask))
2 changes: 1 addition & 1 deletion library/loops/submasks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
//! of every mask of size n
//! @space O(1)
for (int submask = mask; submask;
submask = (submask - 1) & mask)
submask = (submask - 1) & mask)
2 changes: 1 addition & 1 deletion library/loops/supermasks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
//! of every mask of size n
//! @space O(1)
for (int supermask = mask; supermask < (1 << n);
supermask = (supermask + 1) | mask)
supermask = (supermask + 1) | mask)
2 changes: 1 addition & 1 deletion library/math/partitions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ vector<ll> partitions(int n) {
rep(i, 1, n) {
ll sum = 0;
for (int j = 1, pent = 1, sign = 1; pent <= i;
j++, pent += 3 * j - 2, sign = -sign) {
j++, pent += 3 * j - 2, sign = -sign) {
if (pent + j <= i)
sum += dp[i - pent - j] * sign + mod;
sum += dp[i - pent] * sign + mod;
Expand Down
2 changes: 1 addition & 1 deletion library/math/prime_sieve/mobius.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
vi mobius(100'005);
mobius[1] = 1;
rep(i, 1, sz(mobius)) for (int j = i + i; j < sz(mobius);
j += i) mobius[j] -= mobius[i];
j += i) mobius[j] -= mobius[i];
3 changes: 1 addition & 2 deletions library/monotonic_stack/cartesian_binary_tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
vi cart_binary_tree(const vi& l) {
vi p(l);
rep(i, 0, sz(p)) for (int j = i - 1; j != l[i];
j = l[j]) if (l[j] == l[i]) p[j] =
i;
j = l[j]) if (l[j] == l[i]) p[j] = i;
return p;
}
7 changes: 3 additions & 4 deletions library/monotonic_stack/monotonic_stack.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
//! a[le[i]] < a[i]
//! @time O(n)
//! @space O(n)
vi mono_st(const auto& a, auto cmp) {
vi mono_st(const auto& a, const auto& cmp) {
vi l(sz(a));
rep(i, 0, sz(a)) for (
l[i] = i - 1; l[i] >= 0 && !cmp(a[l[i]], a[i]);) l[i] =
l[l[i]];
rep(i, 0, sz(a)) for (l[i] = i - 1;
l[i] >= 0 && !cmp(a[l[i]], a[i]);) l[i] = l[l[i]];
return l;
}
2 changes: 1 addition & 1 deletion library/strings/suffix_array/find/find_string_bs_fast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ match find_str_fast(const T& t) {
int s_l = n, s_len = 0;
auto cmp = [&](int i, int) -> bool {
if (int lcp_len = s_l == n ? 0 : len_lcp(s_l, i);
lcp_len != s_len)
lcp_len != s_len)
return (lcp_len < s_len) ^ (cmp_sufs(s_l, i) < 0);
auto [it_s, it_t] =
mismatch(i + s_len + all(s), s_len + all(t));
Expand Down
2 changes: 1 addition & 1 deletion library/strings/suffix_array/suffix_array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ auto get_sa(const auto& s, int max_num) {
if (sz > 0) sz--;
if (sa_inv[i] == 0) continue;
for (int j = sa[sa_inv[i] - 1];
max(i, j) + sz < n && s[i + sz] == s[j + sz];)
max(i, j) + sz < n && s[i + sz] == s[j + sz];)
sz++;
lcp[sa_inv[i] - 1] = sz;
}
Expand Down
2 changes: 1 addition & 1 deletion library/strings/suffix_array/suffix_array_short.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ auto sa_short(const auto& s) {
if (sz > 0) sz--;
if (sa_inv[i] == 0) continue;
for (int j = sa[sa_inv[i] - 1];
max(i, j) + sz < n && s[i + sz] == s[j + sz];)
max(i, j) + sz < n && s[i + sz] == s[j + sz];)
sz++;
lcp[sa_inv[i] - 1] = sz;
}
Expand Down
1 change: 1 addition & 0 deletions tests/.config/.clang-tidy
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Checks: >
-clang-analyzer-core.UndefinedBinaryOperatorResult,
-clang-analyzer-core.BitwiseShift,
bugprone-argument-comment,
bugprone-assert-side-effect,
bugprone-bad-signal-to-kill-thread,
Expand Down
34 changes: 19 additions & 15 deletions tests/.config/.cppcheck_suppression_list
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
noExplicitConstructor
missingIncludeSystem
functionConst
assertWithSideEffect
unknownMacro
constParameterReference
unusedStructMember:../library/flow/min_cost_max_flow.hpp
unusedStructMember:../library/flow/dinic.hpp:15
unusedStructMember:../library/strings/suffix_array/find/match.hpp:10
unusedStructMember:../library/trees/tree_lift/tree_lift.hpp:17
unusedStructMember:../library/trees/ladder_decomposition/linear_kth_par.hpp:17
unusedStructMember:../library/data_structures/dsu/dsu_bipartite.hpp:9
unusedStructMember:../library/trees/linear_lca.hpp:15
unusedScopedObject:../library/trees/centroid_decomp_uncommon/count_paths_per_length.hpp:12
unusedScopedObject:library_checker_aizu_tests/cd_asserts.hpp:6
unusedScopedObject:../library/trees/centroid_decomp_uncommon/count_paths_per_node.hpp:14
unusedScopedObject:library_checker_aizu_tests/trees/centroid_path_dist.test.cpp:29
unusedScopedObject:../library/trees/edge_centroid_decomp_uncommon/count_paths_per_length.hpp:13
unusedScopedObject:library_checker_aizu_tests/trees/edge_cd_lca.test.cpp:20
unusedScopedObject:library_checker_aizu_tests/trees/edge_cd_reroot_dp.test.cpp:49
unusedScopedObject:library_checker_aizu_tests/trees/cd_jump_on_tree.test.cpp:20
unusedScopedObject:library_checker_aizu_tests/trees/cd_jump_on_tree.test.cpp:58
arrayIndexOutOfBoundsCond:library_checker_aizu_tests/math/linear_prime_sieve.test.cpp:17
Expand All @@ -25,6 +17,7 @@ useStlAlgorithm:../library/graphs/strongly_connected_components/add_edges_strong
useStlAlgorithm:../library/math/matrix_related/row_reduce.hpp:28
useStlAlgorithm:../library/math/count_paths/count_paths_triangle.hpp:24
useStlAlgorithm:../library/math/matrix_related/xor_basis_unordered_intersection.hpp:10
useStlAlgorithm:../library/math/matrix_related/xor_basis_unordered.hpp:16
shadowFunction:../kactl/content/graph/BinaryLifting.h:17
unknownMacro:../kactl/content/graph/BinaryLifting.h:18
constParameter:../kactl/content/graph/BinaryLifting.h:29
Expand All @@ -36,10 +29,6 @@ constParameter:../library/data_structures/wavelet_merge/merge_sort_tree_updates.
constParameter:../library/data_structures/wavelet_merge/wavelet_tree_updates.hpp:49
constParameter:../library/data_structures/wavelet_merge/wavelet_tree_updates.hpp:53
constParameter:../hackpack-cpp/content/number-theory/ModInt.h:45
constParameter:../library/data_structures/deque_op/deque.hpp:10
constParameter:../library/data_structures/deque_op/queue_only.hpp:29
constParameter:../library/data_structures/uncommon/priority_queue_of_updates.hpp:43
constParameter:../library/math/matrix_related/row_reduce.hpp:17
constParameter:library_checker_aizu_tests/data_structures/rmq_inc.test.cpp:11
variableScope:../kactl/content/number-theory/Factor.h:47
syntaxError:../library/math/n_choose_k/pascals_identity.hpp:4
Expand All @@ -51,8 +40,23 @@ syntaxError:../library/loops/submasks.hpp:7
syntaxError:../library/loops/supermasks.hpp:8
syntaxError:../library/math/prime_sieve/mobius.hpp:6
syntaxError:../library/trees/lca_rmq/iterate_subtree.hpp:6
constVariable:../kactl/content/graph/CompressTree.h:20
knownConditionTrueFalse:../library/strings/suffix_array/suffix_array.hpp:62
knownConditionTrueFalse:../library/strings/suffix_array/suffix_array_short.hpp:29
knownConditionTrueFalse:../library/data_structures/dsu/kruskal_tree.hpp:15
constVariable:../kactl/content/numerical/NumberTheoreticTransform.h:30
constVariable:../kactl/content/graph/CompressTree.h:20
functionStatic:../library/monotonic_stack/monotonic_stack.hpp:10
constVariableReference:../kactl/content/graph/CompressTree.h:20
constVariableReference:../library/flow/min_cost_max_flow.hpp:43
constVariableReference:library_checker_aizu_tests/graphs/connected_components_of_complement_graph.test.cpp:21
constVariableReference:library_checker_aizu_tests/handmade_tests/dsu_size.test.cpp:39
constVariableReference:../library/trees/centroid_decomp_uncommon/count_paths_per_length.hpp:34
constVariablePointer:../kactl/content/numerical/FastFourierTransform.h:39
cstyleCast:../kactl/content/numerical/FastFourierTransform.h:39
derefInvalidIterator:../library/data_structures/uncommon/linear_rmq.hpp:28
derefInvalidIterator:library_checker_aizu_tests/handmade_tests/n_choose_k.test.cpp:13
unreadVariable:library_checker_aizu_tests/handmade_tests/permutation_tree_small.test.cpp:12
uninitvar:library_checker_aizu_tests/handmade_tests/seg_tree_find_small.test.cpp:41
unusedFunction:../kactl/content/data-structures/UnionFind.h:14
unusedFunction:../kactl/content/number-theory/ModPow.h:13
unusedFunction:../kactl/stress-tests/utilities/genTree.h:49
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ int main() {
vector<int> edge_weights;
vector<int> to_time(n);
for (int v = lt.find(0), timer = 1;
lt.edge[v] != pii{-1, -1};
v = lt.edge[v].first, timer++) {
lt.edge[v] != pii{-1, -1};
v = lt.edge[v].first, timer++) {
edge_weights.push_back(w_eds[lt.edge[v].second][0]);
to_time[lt.edge[v].first] = timer;
mst_sum += w_eds[lt.edge[v].second][0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ int main() {
int64_t cost = 0;
vector<int> ids;
for (int v = lt.find(0); lt.edge[v].first != -1;
v = lt.edge[v].first) {
v = lt.edge[v].first) {
ids.push_back(w_eds[lt.edge[v].second][0]);
cost += weights[w_eds[lt.edge[v].second][0]];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ int main() {
// bounds[version] = [left index, right index) represents
// subarray range of queue
for (int curr_version = 1; curr_version <= q;
curr_version++) {
curr_version++) {
int type;
cin >> type;
if (type == 0) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#define PROBLEM "https://judge.yosupo.jp/problem/incremental_scc"
#define PROBLEM \
"https://judge.yosupo.jp/problem/incremental_scc"
#include "../template.hpp"

#include "../../../library/graphs/strongly_connected_components/offline_incremental_scc.hpp"
#include "../../../kactl/content/data-structures/UnionFind.h"
#include "../../../library/math/mod_int.hpp"

int main() {
cin.tie(0)->sync_with_stdio(0);
int n, m;
Expand All @@ -19,7 +18,8 @@ int main() {
assert((eds[t][0] == eds[t][1]) == (joins[t] == -1));
vector<int> order(m);
iota(all(order), 0);
ranges::sort(all(order), {}, [&](int i) { return joins[i]; });
ranges::sort(all(order), {},
[&](int i) { return joins[i]; });
UF uf(n);
mint sum = 0;
for (int t = 0, it = 0; t < m; t++) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#define PROBLEM \
"https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_3_C"
#include "../template.hpp"

#include "../../../library/graphs/strongly_connected_components/add_edges_strongly_connected.hpp"
#include "../scc_asserts.hpp"

int main() {
cin.tie(0)->sync_with_stdio(0);
int n, m;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#define PROBLEM "https://judge.yosupo.jp/problem/scc"
#include "../template.hpp"

#include "../../../library/graphs/strongly_connected_components/add_edges_strongly_connected.hpp"
#include "../scc_asserts.hpp"

int main() {
cin.tie(0)->sync_with_stdio(0);
int n, m;
Expand All @@ -18,7 +16,8 @@ int main() {
auto [num_sccs, scc_id] = sccs(adj);
cout << num_sccs << '\n';
vector<vector<int>> each_scc(num_sccs);
for (int i = 0; i < n; i++) each_scc[scc_id[i]].push_back(i);
for (int i = 0; i < n; i++)
each_scc[scc_id[i]].push_back(i);
for (int i = num_sccs - 1; i >= 0; i--) {
cout << sz(each_scc[i]) << " ";
for (auto node : each_scc[i]) cout << node << " ";
Expand Down

This file was deleted.

4 changes: 2 additions & 2 deletions tests/library_checker_aizu_tests/math/xor_basis.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ int main() {
int64_t val2 = unordered.shrink(val1);
assert(val1 == val2);
for (int64_t v : unordered.b)
assert(((1LL << __lg(v)) & val2) == 0);
assert((bit_floor((unsigned long long)v) & val2) == 0);
bool inserted_unordered = unordered.insert(elem);
bool inserted_ordered_ll = ordered_ll.insert(elem);
bool inserted_ordered_bitset =
Expand Down Expand Up @@ -60,7 +60,7 @@ int main() {
}
for (int i1 = 0; i1 < sz(unordered.b); i1++) {
for (int i2 = i1 + 1; i2 < sz(unordered.b);
i2++) {
i2++) {
assert(__lg(unordered.b[i1]) !=
__lg(unordered.b[i2]));
assert(((1LL << __lg(unordered.b[i1])) &
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ void check_condition(const basis<int>& b) {
int n = sz(b.b);
int or_bits = 0;
for (int i = n - 1; i >= 0; i--) {
int bit_i = 1 << __lg(b.b[i]);
int bit_i = bit_floor(unsigned(b.b[i]));
assert((bit_i & or_bits) == 0);
or_bits |= b.b[i];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ int main() {
for (int i = 1; i < n;) {
int j, v;
for (j = 1;
j < z[i] && (v = min(z[j], z[i] - j)) >= z[i + j];
j++)
j < z[i] && (v = min(z[j], z[i] - j)) >= z[i + j];
j++)
z[i + j] = v;
i += j;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/scripts/check_format_lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ find ../library/ library_checker_aizu_tests/ -name "*[A-Z]*" -or -name "*-*" |
grep --invert-match "README" &&
exit 1

clang-format-18 --dry-run --Werror --style=file:.config/.clang-format library_checker_aizu_tests/**/*.hpp ../library/**/*.hpp ../library/**/*.cpp || exit 1
clang-format-19 --dry-run --Werror --style=file:.config/.clang-format library_checker_aizu_tests/**/*.hpp ../library/**/*.hpp ../library/**/*.cpp || exit 1

git submodule init
git submodule update
Expand Down
Loading
Loading