diff --git a/cp-algo/all b/cp-algo/all index bc8d361..9087f61 100644 --- a/cp-algo/all +++ b/cp-algo/all @@ -8,7 +8,7 @@ namespace cp_algo { using namespace data_structures; using namespace geometry; - using namespace algebra; + using namespace math; using namespace linalg; using namespace random; } diff --git a/cp-algo/data_structures/segtree/metas/affine.hpp b/cp-algo/data_structures/segtree/metas/affine.hpp index e4103e2..0888137 100644 --- a/cp-algo/data_structures/segtree/metas/affine.hpp +++ b/cp-algo/data_structures/segtree/metas/affine.hpp @@ -1,12 +1,12 @@ #ifndef CP_ALGO_DATA_STRUCTURES_SEGMENT_TREE_METAS_AFFINE_HPP #define CP_ALGO_DATA_STRUCTURES_SEGMENT_TREE_METAS_AFFINE_HPP #include "base.hpp" -#include "../../../algebra/affine.hpp" +#include "../../../math/affine.hpp" namespace cp_algo::data_structures::segtree::metas { template struct affine_meta: base_meta> { using meta = affine_meta; - using lin = algebra::lin; + using lin = math::lin; base sum = 0; lin to_push = {}; diff --git a/cp-algo/data_structures/treap/metas/reverse.hpp b/cp-algo/data_structures/treap/metas/reverse.hpp index 54182ea..13ceaba 100644 --- a/cp-algo/data_structures/treap/metas/reverse.hpp +++ b/cp-algo/data_structures/treap/metas/reverse.hpp @@ -1,12 +1,12 @@ #ifndef CP_ALGO_DATA_STRUCTURES_TREAP_METAS_REVERSE_HPP #define CP_ALGO_DATA_STRUCTURES_TREAP_METAS_REVERSE_HPP #include "base.hpp" -#include "../../../algebra/affine.hpp" +#include "../../../math/affine.hpp" #include namespace cp_algo::data_structures::treap::metas { template struct reverse_meta: base_meta { - using lin = algebra::lin; + using lin = math::lin; base val; size_t sz = 1; bool reverse = false; diff --git a/cp-algo/linalg/frobenius.hpp b/cp-algo/linalg/frobenius.hpp index 113c8ab..ac6e8cd 100644 --- a/cp-algo/linalg/frobenius.hpp +++ b/cp-algo/linalg/frobenius.hpp @@ -1,16 +1,16 @@ #ifndef CP_ALGO_LINALG_FROBENIUS_HPP #define CP_ALGO_LINALG_FROBENIUS_HPP +#include "../math/poly.hpp" #include "matrix.hpp" -#include "../algebra/poly.hpp" #include #include -namespace cp_algo::linalg { +namespace cp_algo::math::linalg { enum frobenius_mode {blocks, full}; template auto frobenius_form(auto const& A) { using matrix = std::decay_t; using base = matrix::base; - using polyn = algebra::poly_t; + using polyn = math::poly_t; assert(A.n() == A.m()); size_t n = A.n(); std::vector charps; @@ -76,7 +76,7 @@ namespace cp_algo::linalg { template auto frobenius_pow(matrix A, uint64_t k) { - using polyn = algebra::poly_t; + using polyn = math::poly_t; auto [T, Tinv, charps] = frobenius_form(A); std::vector> blocks; for(auto charp: charps) { diff --git a/cp-algo/linalg/matrix.hpp b/cp-algo/linalg/matrix.hpp index d57476c..c5fb23e 100644 --- a/cp-algo/linalg/matrix.hpp +++ b/cp-algo/linalg/matrix.hpp @@ -1,14 +1,14 @@ #ifndef CP_ALGO_LINALG_MATRIX_HPP #define CP_ALGO_LINALG_MATRIX_HPP #include "../random/rng.hpp" -#include "../algebra/common.hpp" +#include "../math/common.hpp" #include "vector.hpp" #include #include #include #include #include -namespace cp_algo::linalg { +namespace cp_algo::math::linalg { template struct matrix: valarray_base, vec> { using base = base_t; diff --git a/cp-algo/linalg/vector.hpp b/cp-algo/linalg/vector.hpp index c0d3f1f..a6820d3 100644 --- a/cp-algo/linalg/vector.hpp +++ b/cp-algo/linalg/vector.hpp @@ -1,14 +1,14 @@ #ifndef CP_ALGO_LINALG_VECTOR_HPP #define CP_ALGO_LINALG_VECTOR_HPP -#include "../algebra/modint.hpp" #include "../random/rng.hpp" +#include "../math/modint.hpp" #include #include #include #include #include #include -namespace cp_algo::linalg { +namespace cp_algo::math::linalg { template struct valarray_base: std::valarray { using Base = std::valarray; @@ -120,7 +120,7 @@ namespace cp_algo::linalg { }; template - requires(std::is_base_of_v, base>) + requires(std::is_base_of_v, base>) struct vec: vec_base, base> { using Base = vec_base, base>; using Base::Base; diff --git a/cp-algo/algebra/README.md b/cp-algo/math/README.md similarity index 100% rename from cp-algo/algebra/README.md rename to cp-algo/math/README.md diff --git a/cp-algo/algebra/affine.hpp b/cp-algo/math/affine.hpp similarity index 93% rename from cp-algo/algebra/affine.hpp rename to cp-algo/math/affine.hpp index 3fc7e0b..644f001 100644 --- a/cp-algo/algebra/affine.hpp +++ b/cp-algo/math/affine.hpp @@ -1,10 +1,10 @@ -#ifndef CP_ALGO_ALGEBRA_AFFINE_HPP -#define CP_ALGO_ALGEBRA_AFFINE_HPP +#ifndef CP_ALGO_MATH_AFFINE_HPP +#define CP_ALGO_MATH_AFFINE_HPP #include #include #include #include -namespace cp_algo::algebra { +namespace cp_algo::math { // a * x + b template struct lin { @@ -68,4 +68,4 @@ namespace cp_algo::algebra { } }; } -#endif // CP_ALGO_ALGEBRA_AFFINE_HPP \ No newline at end of file +#endif // CP_ALGO_MATH_AFFINE_HPP \ No newline at end of file diff --git a/cp-algo/algebra/all b/cp-algo/math/all similarity index 55% rename from cp-algo/algebra/all rename to cp-algo/math/all index 744cb7c..352ab5c 100644 --- a/cp-algo/algebra/all +++ b/cp-algo/math/all @@ -1,8 +1,8 @@ -#ifndef CP_ALGO_ALGEBRA_ALL -#define CP_ALGO_ALGEBRA_ALL +#ifndef CP_ALGO_MATH_ALL +#define CP_ALGO_MATH_ALL #include "modint.hpp" #include "affine.hpp" #include "common.hpp" #include "poly.hpp" #include "fft.hpp" -#endif // CP_ALGO_ALGEBRA_ALL \ No newline at end of file +#endif // CP_ALGO_MATH_ALL \ No newline at end of file diff --git a/cp-algo/math/combinatorics.hpp b/cp-algo/math/combinatorics.hpp new file mode 100644 index 0000000..e63c626 --- /dev/null +++ b/cp-algo/math/combinatorics.hpp @@ -0,0 +1,25 @@ +#ifndef CP_ALGO_MATH_COMBINATORICS_HPP +#define CP_ALGO_MATH_COMBINATORICS_HPP +#include "common.hpp" +namespace cp_algo::math { + template + T binom_large(T n, int r) { + assert(r < math::maxn); + T ans = 1; + for(int i = 0; i < r; i++) { + ans = ans * T(n - i) * small_inv(i + 1); + } + return ans; + } + template + T binom(int n, int r) { + if(r < 0 || r > n) { + return T(0); + } else if(n > math::maxn) { + return binom_large(n, r); + } else { + return math::fact(n) * math::rfact(r) * math::rfact(n-r); + } + } +} +#endif // CP_ALGO_MATH_COMBINATORICS_HPP diff --git a/cp-algo/algebra/common.hpp b/cp-algo/math/common.hpp similarity index 83% rename from cp-algo/algebra/common.hpp rename to cp-algo/math/common.hpp index e1eb183..c72daf8 100644 --- a/cp-algo/algebra/common.hpp +++ b/cp-algo/math/common.hpp @@ -1,8 +1,8 @@ -#ifndef CP_ALGO_ALGEBRA_COMMON_HPP -#define CP_ALGO_ALGEBRA_COMMON_HPP +#ifndef CP_ALGO_MATH_COMMON_HPP +#define CP_ALGO_MATH_COMMON_HPP #include #include -namespace cp_algo::algebra { +namespace cp_algo::math { #ifdef CP_ALGO_MAXN const int maxn = CP_ALGO_MAXN; #else @@ -29,7 +29,6 @@ namespace cp_algo::algebra { T bpow(T const& x, int64_t n) { return bpow(x, n, T(1)); } - template T fact(int n) { static std::vector F(maxn); @@ -68,14 +67,5 @@ namespace cp_algo::algebra { } return F[n]; } - - template - T nCr(int n, int r) { - if(r < 0 || r > n) { - return T(0); - } else { - return fact(n) * rfact(r) * rfact(n-r); - } - } } -#endif // CP_ALGO_ALGEBRA_COMMON_HPP +#endif // CP_ALGO_MATH_COMMON_HPP diff --git a/cp-algo/algebra/fft.hpp b/cp-algo/math/fft.hpp similarity index 96% rename from cp-algo/algebra/fft.hpp rename to cp-algo/math/fft.hpp index aa36135..9f2ea3f 100644 --- a/cp-algo/algebra/fft.hpp +++ b/cp-algo/math/fft.hpp @@ -1,12 +1,12 @@ -#ifndef CP_ALGO_ALGEBRA_FFT_HPP -#define CP_ALGO_ALGEBRA_FFT_HPP +#ifndef CP_ALGO_MATH_FFT_HPP +#define CP_ALGO_MATH_FFT_HPP #include "common.hpp" #include "modint.hpp" #include #include #include #include -namespace cp_algo::algebra::fft { +namespace cp_algo::math::fft { using ftype = double; using point = std::complex; @@ -143,4 +143,4 @@ namespace cp_algo::algebra::fft { } } } -#endif // CP_ALGO_ALGEBRA_FFT_HPP +#endif // CP_ALGO_MATH_FFT_HPP diff --git a/cp-algo/algebra/modint.hpp b/cp-algo/math/modint.hpp similarity index 96% rename from cp-algo/algebra/modint.hpp rename to cp-algo/math/modint.hpp index 383443b..228fb78 100644 --- a/cp-algo/algebra/modint.hpp +++ b/cp-algo/math/modint.hpp @@ -1,8 +1,8 @@ -#ifndef CP_ALGO_ALGEBRA_MODINT_HPP -#define CP_ALGO_ALGEBRA_MODINT_HPP +#ifndef CP_ALGO_MATH_MODINT_HPP +#define CP_ALGO_MATH_MODINT_HPP #include "common.hpp" #include -namespace cp_algo::algebra { +namespace cp_algo::math { template struct modint_base { static int64_t mod() { @@ -102,4 +102,4 @@ namespace cp_algo::algebra { }; int64_t dynamic_modint::m = 0; } -#endif // CP_ALGO_ALGEBRA_MODINT_HPP +#endif // CP_ALGO_MATH_MODINT_HPP diff --git a/cp-algo/algebra/number_theory.hpp b/cp-algo/math/number_theory.hpp similarity index 95% rename from cp-algo/algebra/number_theory.hpp rename to cp-algo/math/number_theory.hpp index ff02cca..b446aca 100644 --- a/cp-algo/algebra/number_theory.hpp +++ b/cp-algo/math/number_theory.hpp @@ -1,5 +1,5 @@ -#ifndef CP_ALGO_ALGEBRA_NUMBER_THEORY_HPP -#define CP_ALGO_ALGEBRA_NUMBER_THEORY_HPP +#ifndef CP_ALGO_MATH_NUMBER_THEORY_HPP +#define CP_ALGO_MATH_NUMBER_THEORY_HPP #include "../random/rng.hpp" #include "affine.hpp" #include "modint.hpp" @@ -7,7 +7,7 @@ #include #include #include -namespace cp_algo::algebra { +namespace cp_algo::math { // https://en.wikipedia.org/wiki/Berlekamp-Rabin_algorithm template std::optional sqrt(base b) { @@ -115,4 +115,4 @@ namespace cp_algo::algebra { }); } } -#endif // CP_ALGO_ALGEBRA_NUMBER_THEORY_HPP +#endif // CP_ALGO_MATH_NUMBER_THEORY_HPP diff --git a/cp-algo/algebra/poly.hpp b/cp-algo/math/poly.hpp similarity index 99% rename from cp-algo/algebra/poly.hpp rename to cp-algo/math/poly.hpp index 423ecce..a5b9167 100644 --- a/cp-algo/algebra/poly.hpp +++ b/cp-algo/math/poly.hpp @@ -1,8 +1,9 @@ -#ifndef CP_ALGO_ALGEBRA_POLY_HPP -#define CP_ALGO_ALGEBRA_POLY_HPP +#ifndef CP_ALGO_MATH_POLY_HPP +#define CP_ALGO_MATH_POLY_HPP #include "poly/impl/euclid.hpp" #include "poly/impl/base.hpp" #include "poly/impl/div.hpp" +#include "combinatorics.hpp" #include "number_theory.hpp" #include "fft.hpp" #include @@ -12,7 +13,7 @@ #include #include #include -namespace cp_algo::algebra { +namespace cp_algo::math { template struct poly_t { using base = T; @@ -277,7 +278,7 @@ namespace cp_algo::algebra { auto ans = div_xk(i).sqrt(n - i / 2); return ans ? ans->mul_xk(i / 2) : ans; } - auto st = algebra::sqrt((*this)[0]); + auto st = math::sqrt((*this)[0]); if(st) { poly_t ans = *st; size_t a = 1; @@ -659,4 +660,4 @@ namespace cp_algo::algebra { return b * a; } }; -#endif // CP_ALGO_ALGEBRA_POLY_HPP +#endif // CP_ALGO_MATH_POLY_HPP diff --git a/cp-algo/algebra/poly/impl/base.hpp b/cp-algo/math/poly/impl/base.hpp similarity index 91% rename from cp-algo/algebra/poly/impl/base.hpp rename to cp-algo/math/poly/impl/base.hpp index 5aa8d9a..5ef68be 100644 --- a/cp-algo/algebra/poly/impl/base.hpp +++ b/cp-algo/math/poly/impl/base.hpp @@ -1,10 +1,10 @@ -#ifndef CP_ALGO_ALGEBRA_POLY_IMPL_BASE_HPP -#define CP_ALGO_ALGEBRA_POLY_IMPL_BASE_HPP +#ifndef CP_ALGO_MATH_POLY_IMPL_BASE_HPP +#define CP_ALGO_MATH_POLY_IMPL_BASE_HPP #include #include #include // really basic operations, typically taking O(n) -namespace cp_algo::algebra::poly::impl { +namespace cp_algo::math::poly::impl { void normalize(auto& p) { while(p.deg() >= 0 && p.lead() == 0) { p.a.pop_back(); @@ -64,4 +64,4 @@ namespace cp_algo::algebra::poly::impl { return p; } } -#endif // CP_ALGO_ALGEBRA_POLY_IMPL_BASE_HPP +#endif // CP_ALGO_MATH_POLY_IMPL_BASE_HPP diff --git a/cp-algo/algebra/poly/impl/div.hpp b/cp-algo/math/poly/impl/div.hpp similarity index 95% rename from cp-algo/algebra/poly/impl/div.hpp rename to cp-algo/math/poly/impl/div.hpp index f2aa384..c30e38e 100644 --- a/cp-algo/algebra/poly/impl/div.hpp +++ b/cp-algo/math/poly/impl/div.hpp @@ -1,10 +1,10 @@ -#ifndef CP_ALGO_ALGEBRA_POLY_IMPL_DIV_HPP -#define CP_ALGO_ALGEBRA_POLY_IMPL_DIV_HPP +#ifndef CP_ALGO_MATH_POLY_IMPL_DIV_HPP +#define CP_ALGO_MATH_POLY_IMPL_DIV_HPP #include "../../fft.hpp" #include "../../common.hpp" #include // operations related to polynomial division -namespace cp_algo::algebra::poly::impl { +namespace cp_algo::math::poly::impl { auto divmod_slow(auto const& p, auto const& q) { auto R = p; auto D = decltype(p){}; @@ -113,4 +113,4 @@ namespace cp_algo::algebra::poly::impl { ).mod_xk(n); } } -#endif // CP_ALGO_ALGEBRA_POLY_IMPL_DIV_HPP +#endif // CP_ALGO_MATH_POLY_IMPL_DIV_HPP diff --git a/cp-algo/algebra/poly/impl/euclid.hpp b/cp-algo/math/poly/impl/euclid.hpp similarity index 94% rename from cp-algo/algebra/poly/impl/euclid.hpp rename to cp-algo/math/poly/impl/euclid.hpp index 06f4ab4..9fb20e7 100644 --- a/cp-algo/algebra/poly/impl/euclid.hpp +++ b/cp-algo/math/poly/impl/euclid.hpp @@ -1,5 +1,5 @@ -#ifndef CP_ALGO_ALGEBRA_POLY_IMPL_EUCLID_HPP -#define CP_ALGO_ALGEBRA_POLY_IMPL_EUCLID_HPP +#ifndef CP_ALGO_MATH_POLY_IMPL_EUCLID_HPP +#define CP_ALGO_MATH_POLY_IMPL_EUCLID_HPP #include "../../affine.hpp" #include "../../fft.hpp" #include @@ -10,7 +10,7 @@ #include #include // operations related to gcd and Euclidean algo -namespace cp_algo::algebra::poly::impl { +namespace cp_algo::math::poly::impl { template using gcd_result = std::pair< std::list>, @@ -99,4 +99,4 @@ namespace cp_algo::algebra::poly::impl { return Tr.b / q[0]; } } -#endif // CP_ALGO_ALGEBRA_POLY_IMPL_EUCLID_HPP +#endif // CP_ALGO_MATH_POLY_IMPL_EUCLID_HPP diff --git a/verify/data_structures/segtree/range_affine_range_sum.test.cpp b/verify/data_structures/segtree/range_affine_range_sum.test.cpp index fcf17b9..c9db102 100644 --- a/verify/data_structures/segtree/range_affine_range_sum.test.cpp +++ b/verify/data_structures/segtree/range_affine_range_sum.test.cpp @@ -2,13 +2,13 @@ #define PROBLEM "https://judge.yosupo.jp/problem/range_affine_range_sum" #include "cp-algo/data_structures/segtree/metas/affine.hpp" #include "cp-algo/data_structures/segtree.hpp" -#include "cp-algo/algebra/modint.hpp" +#include "cp-algo/math/modint.hpp" #include using namespace std; using namespace cp_algo::data_structures; -using base = cp_algo::algebra::modint<998244353>; +using base = cp_algo::math::modint<998244353>; using meta = segtree::metas::affine_meta; void solve() { diff --git a/verify/data_structures/treap/dynamic_sequence_range_affine_range_sum.test.cpp b/verify/data_structures/treap/dynamic_sequence_range_affine_range_sum.test.cpp index 72a9438..a58cdf4 100644 --- a/verify/data_structures/treap/dynamic_sequence_range_affine_range_sum.test.cpp +++ b/verify/data_structures/treap/dynamic_sequence_range_affine_range_sum.test.cpp @@ -1,6 +1,6 @@ // @brief Dynamic Range Affine Range Sum #define PROBLEM "https://judge.yosupo.jp/problem/dynamic_sequence_range_affine_range_sum" -#include "cp-algo/algebra/modint.hpp" +#include "cp-algo/math/modint.hpp" #include "cp-algo/data_structures/treap/metas/reverse.hpp" #include "cp-algo/data_structures/treap.hpp" #include @@ -8,7 +8,7 @@ using namespace std; using namespace cp_algo::data_structures::treap; -using base = cp_algo::algebra::modint<998244353>; +using base = cp_algo::math::modint<998244353>; using meta = metas::reverse_meta; using node_t = node; using treap = node_t::treap; diff --git a/verify/linalg/characteristic.test.cpp b/verify/linalg/characteristic.test.cpp index d6d4e25..7b62be8 100644 --- a/verify/linalg/characteristic.test.cpp +++ b/verify/linalg/characteristic.test.cpp @@ -7,8 +7,8 @@ #include using namespace std; -using namespace cp_algo::algebra; -using namespace cp_algo::linalg; +using namespace cp_algo::math; +using namespace cp_algo::math::linalg; const int mod = 998244353; using base = modint; diff --git a/verify/linalg/det.test.cpp b/verify/linalg/det.test.cpp index 2c45cfa..24f5e6a 100644 --- a/verify/linalg/det.test.cpp +++ b/verify/linalg/det.test.cpp @@ -6,8 +6,8 @@ #include using namespace std; -using namespace cp_algo::linalg; -using namespace cp_algo::algebra; +using namespace cp_algo::math::linalg; +using namespace cp_algo::math; const int mod = 998244353; diff --git a/verify/linalg/inv.test.cpp b/verify/linalg/inv.test.cpp index 8a30fad..fe7f603 100644 --- a/verify/linalg/inv.test.cpp +++ b/verify/linalg/inv.test.cpp @@ -6,8 +6,8 @@ #include using namespace std; -using namespace cp_algo::linalg; -using namespace cp_algo::algebra; +using namespace cp_algo::math::linalg; +using namespace cp_algo::math; const int mod = 998244353; diff --git a/verify/linalg/pow.test.cpp b/verify/linalg/pow.test.cpp index ccfc56d..eb02829 100644 --- a/verify/linalg/pow.test.cpp +++ b/verify/linalg/pow.test.cpp @@ -6,8 +6,8 @@ #include using namespace std; -using namespace cp_algo::linalg; -using namespace cp_algo::algebra; +using namespace cp_algo::math::linalg; +using namespace cp_algo::math; const int mod = 998244353; diff --git a/verify/linalg/pow_fast.test.cpp b/verify/linalg/pow_fast.test.cpp index daad8a9..1140b04 100644 --- a/verify/linalg/pow_fast.test.cpp +++ b/verify/linalg/pow_fast.test.cpp @@ -7,8 +7,8 @@ #include using namespace std; -using namespace cp_algo::algebra; -using namespace cp_algo::linalg; +using namespace cp_algo::math; +using namespace cp_algo::math::linalg; const int mod = 998244353; using base = modint; diff --git a/verify/linalg/prod.test.cpp b/verify/linalg/prod.test.cpp index 3117bc1..619ecf2 100644 --- a/verify/linalg/prod.test.cpp +++ b/verify/linalg/prod.test.cpp @@ -6,8 +6,8 @@ #include using namespace std; -using namespace cp_algo::linalg; -using namespace cp_algo::algebra; +using namespace cp_algo::math::linalg; +using namespace cp_algo::math; const int mod = 998244353; using base = modint; diff --git a/verify/linalg/prod_dynamic_modint.test.cpp b/verify/linalg/prod_dynamic_modint.test.cpp index 2ea758a..95de12a 100644 --- a/verify/linalg/prod_dynamic_modint.test.cpp +++ b/verify/linalg/prod_dynamic_modint.test.cpp @@ -6,8 +6,8 @@ #include using namespace std; -using namespace cp_algo::linalg; -using namespace cp_algo::algebra; +using namespace cp_algo::math::linalg; +using namespace cp_algo::math; using base = dynamic_modint; const int mod = 998244353; diff --git a/verify/linalg/rank.test.cpp b/verify/linalg/rank.test.cpp index e25063b..7522ac7 100644 --- a/verify/linalg/rank.test.cpp +++ b/verify/linalg/rank.test.cpp @@ -6,8 +6,8 @@ #include using namespace std; -using namespace cp_algo::algebra; -using namespace cp_algo::linalg; +using namespace cp_algo::math; +using namespace cp_algo::math::linalg; const int mod = 998244353; using base = modint; diff --git a/verify/linalg/system.test.cpp b/verify/linalg/system.test.cpp index 9d388cb..1e7407f 100644 --- a/verify/linalg/system.test.cpp +++ b/verify/linalg/system.test.cpp @@ -6,8 +6,8 @@ #include using namespace std; -using namespace cp_algo::linalg; -using namespace cp_algo::algebra; +using namespace cp_algo::math::linalg; +using namespace cp_algo::math; const int mod = 998244353; diff --git a/verify/number_theory/factorize.test.cpp b/verify/number_theory/factorize.test.cpp index be17a0c..bcc7539 100644 --- a/verify/number_theory/factorize.test.cpp +++ b/verify/number_theory/factorize.test.cpp @@ -2,11 +2,11 @@ #define PROBLEM "https://judge.yosupo.jp/problem/factorize" #pragma GCC optimize("Ofast,unroll-loops") #pragma GCC target("avx2,tune=native") -#include "cp-algo/algebra/number_theory.hpp" +#include "cp-algo/math/number_theory.hpp" #include using namespace std; -using namespace cp_algo::algebra; +using namespace cp_algo::math; void solve() { int64_t m; diff --git a/verify/number_theory/modsqrt.test.cpp b/verify/number_theory/modsqrt.test.cpp index 537a71e..9c18e91 100644 --- a/verify/number_theory/modsqrt.test.cpp +++ b/verify/number_theory/modsqrt.test.cpp @@ -2,11 +2,11 @@ #define PROBLEM "https://judge.yosupo.jp/problem/sqrt_mod" #pragma GCC optimize("Ofast,unroll-loops") #pragma GCC target("avx2,tune=native") -#include "cp-algo/algebra/number_theory.hpp" +#include "cp-algo/math/number_theory.hpp" #include using namespace std; -using namespace cp_algo::algebra; +using namespace cp_algo::math; using base = dynamic_modint; void solve() { diff --git a/verify/number_theory/primality.test.cpp b/verify/number_theory/primality.test.cpp index 3a76db6..26f92fb 100644 --- a/verify/number_theory/primality.test.cpp +++ b/verify/number_theory/primality.test.cpp @@ -2,11 +2,11 @@ #define PROBLEM "https://judge.yosupo.jp/problem/primality_test" #pragma GCC optimize("Ofast,unroll-loops") #pragma GCC target("avx2,tune=native") -#include "cp-algo/algebra/number_theory.hpp" +#include "cp-algo/math/number_theory.hpp" #include using namespace std; -using namespace cp_algo::algebra; +using namespace cp_algo::math; void solve() { int64_t m; diff --git a/verify/number_theory/primitive_root.test.cpp b/verify/number_theory/primitive_root.test.cpp index a60875e..72eb8b0 100644 --- a/verify/number_theory/primitive_root.test.cpp +++ b/verify/number_theory/primitive_root.test.cpp @@ -2,12 +2,12 @@ #define PROBLEM "https://judge.yosupo.jp/problem/primitive_root" #pragma GCC optimize("Ofast,unroll-loops") #pragma GCC target("avx2,tune=native") -#include "cp-algo/algebra/number_theory.hpp" +#include "cp-algo/math/number_theory.hpp" #include using namespace std; using namespace cp_algo; -using namespace algebra; +using namespace math; using base = dynamic_modint; void solve() { diff --git a/verify/poly/convolution107.test.cpp b/verify/poly/convolution107.test.cpp index 4fd2b5f..30789ae 100644 --- a/verify/poly/convolution107.test.cpp +++ b/verify/poly/convolution107.test.cpp @@ -1,10 +1,10 @@ // @brief Convolution mod $10^9+7$ #define PROBLEM "https://judge.yosupo.jp/problem/convolution_mod_1000000007" -#include "cp-algo/algebra/poly.hpp" +#include "cp-algo/math/poly.hpp" #include using namespace std; -using namespace cp_algo::algebra; +using namespace cp_algo::math; const int mod = 1e9 + 7; using base = modint; diff --git a/verify/poly/div.test.cpp b/verify/poly/div.test.cpp index 7ef24a0..b2477d1 100644 --- a/verify/poly/div.test.cpp +++ b/verify/poly/div.test.cpp @@ -1,10 +1,10 @@ // @brief Division of Polynomials #define PROBLEM "https://judge.yosupo.jp/problem/division_of_polynomials" -#include "cp-algo/algebra/poly.hpp" +#include "cp-algo/math/poly.hpp" #include using namespace std; -using namespace cp_algo::algebra; +using namespace cp_algo::math; const int mod = 998244353; using base = modint; diff --git a/verify/poly/find_linrec.test.cpp b/verify/poly/find_linrec.test.cpp index 0d9b70f..db46900 100644 --- a/verify/poly/find_linrec.test.cpp +++ b/verify/poly/find_linrec.test.cpp @@ -1,10 +1,10 @@ // @brief Find Linear Recurrence #define PROBLEM "https://judge.yosupo.jp/problem/find_linear_recurrence" -#include "cp-algo/algebra/poly.hpp" +#include "cp-algo/math/poly.hpp" #include using namespace std; -using namespace cp_algo::algebra; +using namespace cp_algo::math; const int mod = 998244353; using base = modint; diff --git a/verify/poly/inv.test.cpp b/verify/poly/inv.test.cpp index ce36a1b..aabeecb 100644 --- a/verify/poly/inv.test.cpp +++ b/verify/poly/inv.test.cpp @@ -1,10 +1,10 @@ // @brief Inv of Power Series #define PROBLEM "https://judge.yosupo.jp/problem/inv_of_formal_power_series" -#include "cp-algo/algebra/poly.hpp" +#include "cp-algo/math/poly.hpp" #include using namespace std; -using namespace cp_algo::algebra; +using namespace cp_algo::math; const int mod = 998244353; using base = modint; diff --git a/verify/poly/inv_mod.test.cpp b/verify/poly/inv_mod.test.cpp index 7382c89..5dac0f4 100644 --- a/verify/poly/inv_mod.test.cpp +++ b/verify/poly/inv_mod.test.cpp @@ -1,10 +1,10 @@ // @brief Inv of Polynomials #define PROBLEM "https://judge.yosupo.jp/problem/inv_of_polynomials" -#include "cp-algo/algebra/poly.hpp" +#include "cp-algo/math/poly.hpp" #include using namespace std; -using namespace cp_algo::algebra; +using namespace cp_algo::math; const int mod = 998244353; using base = modint; diff --git a/verify/poly/linrec_consecutive.test.cpp b/verify/poly/linrec_consecutive.test.cpp index 6d1095e..c25230c 100644 --- a/verify/poly/linrec_consecutive.test.cpp +++ b/verify/poly/linrec_consecutive.test.cpp @@ -1,10 +1,10 @@ // @brief Consecutive Terms of Linear Recursion #define PROBLEM "https://judge.yosupo.jp/problem/consecutive_terms_of_linear_recurrent_sequence" -#include "cp-algo/algebra/poly.hpp" +#include "cp-algo/math/poly.hpp" #include using namespace std; -using namespace cp_algo::algebra; +using namespace cp_algo::math; const int mod = 998244353; using base = modint; diff --git a/verify/poly/roots.test.cpp b/verify/poly/roots.test.cpp index fc9c447..f9d5d91 100644 --- a/verify/poly/roots.test.cpp +++ b/verify/poly/roots.test.cpp @@ -1,10 +1,10 @@ // @brief Polynomial Root Finding #define PROBLEM "https://judge.yosupo.jp/problem/polynomial_root_finding" -#include "cp-algo/algebra/poly.hpp" +#include "cp-algo/math/poly.hpp" #include using namespace std; -using namespace cp_algo::algebra; +using namespace cp_algo::math; using namespace cp_algo::random; const int mod = 998244353; diff --git a/verify/poly/sqrt.test.cpp b/verify/poly/sqrt.test.cpp index 10faa38..6c8b29a 100644 --- a/verify/poly/sqrt.test.cpp +++ b/verify/poly/sqrt.test.cpp @@ -1,11 +1,11 @@ // @brief Sqrt of Power Series #define PROBLEM "https://judge.yosupo.jp/problem/sqrt_of_formal_power_series" -#include "cp-algo/algebra/poly.hpp" -#include "cp-algo/algebra/modint.hpp" +#include "cp-algo/math/poly.hpp" +#include "cp-algo/math/modint.hpp" #include using namespace std; -using namespace cp_algo::algebra; +using namespace cp_algo::math; const int mod = 998244353; using base = modint; diff --git a/verify/poly/wildcard.test.cpp b/verify/poly/wildcard.test.cpp index 8c4f950..8518b8c 100644 --- a/verify/poly/wildcard.test.cpp +++ b/verify/poly/wildcard.test.cpp @@ -2,11 +2,11 @@ #define PROBLEM "https://judge.yosupo.jp/problem/wildcard_pattern_matching" #pragma GCC optimize("Ofast,unroll-loops") #pragma GCC target("avx2,tune=native") -#include "cp-algo/algebra/poly.hpp" +#include "cp-algo/math/poly.hpp" #include using namespace std; -using namespace cp_algo::algebra; +using namespace cp_algo::math; const int mod = 1e9 + 9;