Skip to content

Commit

Permalink
fix assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
yosupo06 committed Mar 26, 2023
1 parent b76ba51 commit 1a2785d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions atcoder/convolution.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,20 +221,19 @@ std::vector<mint> convolution(std::vector<mint>&& a, std::vector<mint>&& 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 <class mint, internal::is_static_modint_t<mint>* = nullptr>
std::vector<mint> convolution(const std::vector<mint>& a,
const std::vector<mint>& b) {
int n = int(a.size()), m = int(b.size());
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);
Expand All @@ -250,7 +249,7 @@ std::vector<T> convolution(const std::vector<T>& a, const std::vector<T>& b) {
using mint = static_modint<mod>;

int z = (int)internal::bit_ceil((unsigned int)(n + m - 1));
assert(mint::mod() % z == 1);
assert((mint::mod() - 1) % z == 0);

std::vector<mint> a2(n), b2(m);
for (int i = 0; i < n; i++) {
Expand Down

0 comments on commit 1a2785d

Please sign in to comment.