diff --git a/atcoder/convolution.hpp b/atcoder/convolution.hpp index 059b5c6..ecfbc44 100644 --- a/atcoder/convolution.hpp +++ b/atcoder/convolution.hpp @@ -221,12 +221,11 @@ std::vector convolution(std::vector&& a, std::vector&& b) { if (!n || !m) return {}; int z = (int)internal::bit_ceil((unsigned int)(n + m - 1)); - assert(mint::mod() % z == 1); + assert((mint::mod() - 1) % z == 0); if (std::min(n, m) <= 60) return convolution_naive(a, b); return internal::convolution_fft(a, b); } - template * = nullptr> std::vector convolution(const std::vector& a, const std::vector& b) { @@ -234,7 +233,7 @@ std::vector convolution(const std::vector& a, if (!n || !m) return {}; int z = (int)internal::bit_ceil((unsigned int)(n + m - 1)); - assert(mint::mod() % z == 1); + assert((mint::mod() - 1) % z == 0); if (std::min(n, m) <= 60) return convolution_naive(a, b); return internal::convolution_fft(a, b); @@ -250,7 +249,7 @@ std::vector convolution(const std::vector& a, const std::vector& b) { using mint = static_modint; int z = (int)internal::bit_ceil((unsigned int)(n + m - 1)); - assert(mint::mod() % z == 1); + assert((mint::mod() - 1) % z == 0); std::vector a2(n), b2(m); for (int i = 0; i < n; i++) {