From 1a2785d62178978bef3af9529f6774b534135835 Mon Sep 17 00:00:00 2001 From: Kohei Morita Date: Sun, 26 Mar 2023 15:51:39 +0900 Subject: [PATCH] fix assertion --- atcoder/convolution.hpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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++) {