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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//! @param convex,arbitrary arrays where convex satisfies
//! convex[i+1]-convex[i] <= convex[i+2]-convex[i+1]
//! @returns array `res` where `res[k]` = the min of
//! (a[i]+b[j]) for all pairs (i,j) where i+j==k
//! (convex[j]+arbitrary[i]) over pairs with i+j==k
//! @time O((n + m) log (n + m))
//! @space O(n + m)
vi min_plus(const vi& convex, const vi& arbitrary) {
Expand Down
4 changes: 2 additions & 2 deletions library/data_structures_[l,r)/bit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
//! // sum = a[0] + a[1] + ... + a[r - 1]
//! });
//! int r = bit.walk2(sum);
//! // Returns min r s.t. sum of [0,r] >= sum
//! // Returns n if sum of [0,n-1] < sum
//! // Returns min r s.t. sum of [0,r+1) >= sum
//! // Returns n if sum of [0,n) < sum
//! // Returns -1 if sum <= 0
//! @endcode
//! @time O(n + q log n)
Expand Down
1 change: 1 addition & 0 deletions library/graphs/dijkstra.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//! auto d = dijkstra(g, source);
//! @endcode
//! d[v] = min dist from source->..->v
//! requires weights >= 0
//! @time O(n + (m log m))
//! @space O(n + m)
vector<ll> dijkstra(const auto& g, int s) {
Expand Down
4 changes: 2 additions & 2 deletions library/graphs/min_vertex_cover.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
//! auto [mvc_l, mvc_r] = cover(g, r);
//! // mvc_l[u] == 1 iff u in mvc
//! @endcode
//! @time O(n + q * log n)
//! @space O(n * \alpha(n))
//! @time O(n + m)
//! @space O(n)
pair<vi, vi> cover(const vector<vi>& g, vi& r) {
int n = sz(g), t = 0;
vi cl(n), cr(sz(r)), q(n);
Expand Down
1 change: 1 addition & 0 deletions library/graphs/uncommon/enumerate_triangles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
//! //u, v, w form a triangle
//! });
//! @endcode
//! requires no self loops or multi edges
//! @time O(n + m ^ (3/2))
//! @space O(n + m)
void enumerate_triangles(const vector<pii>& edges, int n,
Expand Down
1 change: 1 addition & 0 deletions library/loops/submasks.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once
//! loops over submasks in decreasing order
//! excludes the empty submask
//! @param mask a submask of 2^n-1
//! @time O(3^n) to iterate every submask
//! of every mask of size n
Expand Down
1 change: 1 addition & 0 deletions library/math/derangements.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//! auto der = derangements(n, mod);
//! @endcode
//! der[i] = number of permutations p with p[i]!=i
//! requires n >= 1
//! @time O(n)
//! @space O(n)
vector<ll> derangements(int n, int mod) {
Expand Down
1 change: 1 addition & 0 deletions library/math/matrix_related/row_reduce.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//! columns [0,cols) of mat represent a matrix
//! columns [cols,m) of mat are also
//! affected by row operations
//! requires mod is prime
//! @time O(n * m * min(cols, n))
//! @space O(1)
pii row_reduce(vector<vi>& mat, int cols) {
Expand Down
1 change: 1 addition & 0 deletions library/math/mod_division.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//! @code
//! int quotient = mod_div(x, y); // returns x * y^-1
//! @endcode
//! requires gcd(y, mod) == 1
//! @time O(log(y))
//! @space O(1)
const int mod = 998244353;
Expand Down
2 changes: 1 addition & 1 deletion library/math/num_distinct_subsequences.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
//! returns the number of distinct subsequences
//! of a, including the empty subsquence
//! of a, including the empty subsequence
//! @time O(n log n)
//! @space O(n)
int num_subsequences(const vi& a, int mod) {
Expand Down
2 changes: 1 addition & 1 deletion library/math/partitions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const int mod = 998'244'353;
//! @code
//! auto p = partitions(n);
//! @endcode
//! p[i] = number of partitions of i numbers
//! p[i] = number of partitions of i
//! @time O(n sqrt n)
//! @space O(n)
vector<ll> partitions(int n) {
Expand Down
2 changes: 2 additions & 0 deletions library/strings/binary_trie.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
//! bt.update(num, 1); // insert
//! bt.update(num, -1); // erase
//! @endcode
//! requires 0 <= num < 2^61
//! walk requires a non-empty trie
//! @time O(q * mx_bit)
//! @space O(q * mx_bit)
const ll mx_bit = 1LL << 60;
Expand Down
1 change: 1 addition & 0 deletions library/strings/kmp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
//! auto match2 = kmp1.find_str(s_vec);
//! @endcode
//! if match[i] == 1 then s[i,ssize(t)) == t
//! requires t non-empty
//! @time O(|s| + |t|)
//! @space O(|s| + |t|)
// NOLINTNEXTLINE(readability-identifier-naming)
Expand Down
6 changes: 3 additions & 3 deletions library/strings/suffix_array/compare/compare_substrings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
//! int cmp = saq.cmp_substrs(l1,r1,l2,r2);
//! @endcode
//! requires l1,l2 < n
//! if cmp1<0 then s[l1,r1) < s[l2,r2)
//! if cmp1=0 then s[l1,r1) = s[l2,r2)
//! if cmp1>0 then s[l1,r1) > s[l2,r2)
//! if cmp<0 then s[l1,r1) < s[l2,r2)
//! if cmp=0 then s[l1,r1) = s[l2,r2)
//! if cmp>0 then s[l1,r1) > s[l2,r2)
//! @time O(1)
//! @space O(1)
int cmp_substrs(int l1, int r1, int l2, int r2) {
Expand Down
1 change: 1 addition & 0 deletions library/trees/centroid_decomp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//! vector<basic_string<int>> g(n);
//! vector<int> p = cd(g, [&](int c) {});
//! @endcode
//! g is mutated (edges removed)
//! @time O(n log n)
//! @space O(n)
vi cd(auto& g, auto f) {
Expand Down
1 change: 1 addition & 0 deletions library/trees/edge_cd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
//! });
//! @endcode
//! handle single-edge-paths separately
//! g is mutated (edges reordered/removed)
//! @time O(n logφ n)
//! @space O(n)
template<class G> void edge_cd(vector<G>& g, auto f) {
Expand Down
1 change: 1 addition & 0 deletions library/trees/hld.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//! });
//! auto [l, r] = hld.subtree(u); // [l, r)
//! @endcode
//! g is mutated (parent edges removed)
//! @time O(n + q log^2 n)
//! @space O(n)
// NOLINTNEXTLINE(readability-identifier-naming)
Expand Down
4 changes: 2 additions & 2 deletions tests/.config/.cppcheck_suppression_list
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ arrayIndexOutOfBoundsCond:library_checker_aizu_tests/math/linear_prime_sieve.tes
negativeContainerIndex:../library/strings/suffix_array/burrows_wheeler.hpp:50
useStlAlgorithm:../kactl/content/numerical/FastFourierTransform.h:53
useStlAlgorithm:../library/graphs/strongly_connected_components/add_edges_strongly_connected.hpp:58
useStlAlgorithm:../library/math/matrix_related/row_reduce.hpp:28
useStlAlgorithm:../library/math/matrix_related/row_reduce.hpp:29
useStlAlgorithm:../library/math/count_paths/count_paths_triangle.hpp:25
useStlAlgorithm:../library/math/matrix_related/xor_basis_unordered.hpp:14
shadowFunction:../kactl/content/graph/BinaryLifting.h:17
Expand All @@ -35,7 +35,7 @@ syntaxError:../library/math/prime_sieve/calc_sieve.hpp:6
syntaxError:../library/math/prime_sieve/calc_linear_sieve.hpp:6
syntaxError:../library/loops/chooses.hpp:7
syntaxError:../library/loops/quotients.hpp:10
syntaxError:../library/loops/submasks.hpp:7
syntaxError:../library/loops/submasks.hpp:8
syntaxError:../library/loops/supermasks.hpp:8
syntaxError:../library/math/prime_sieve/mobius.hpp:6
syntaxError:../library/trees/lca_rmq/iterate_subtree.hpp:6
Expand Down
Loading