Skip to content

Commit bc8789c

Browse files
committed
add: assert of convolution_ll
1 parent f669803 commit bc8789c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

atcoder/convolution.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,12 @@ std::vector<long long> convolution_ll(const std::vector<long long>& a,
274274
internal::inv_gcd(MOD1 * MOD3, MOD2).second;
275275
static constexpr unsigned long long i3 =
276276
internal::inv_gcd(MOD1 * MOD2, MOD3).second;
277+
278+
static constexpr int MAX_AB_BIT = 24;
279+
static_assert(MOD1 % (1ull << MAX_AB_BIT) == 1);
280+
static_assert(MOD2 % (1ull << MAX_AB_BIT) == 1);
281+
static_assert(MOD3 % (1ull << MAX_AB_BIT) == 1);
282+
assert(a.size() + b.size() - 1 <= (1ull << MAX_AB_BIT));
277283

278284
auto c1 = convolution<MOD1>(a, b);
279285
auto c2 = convolution<MOD2>(a, b);

0 commit comments

Comments
 (0)