Skip to content

Commit fc41a79

Browse files
committed
Fixes
1 parent 434b9be commit fc41a79

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

cp-algo/math/fft.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ namespace cp_algo::math::fft {
272272
using base = std::decay_t<decltype(a[0])>;
273273
auto n = std::max(flen, std::bit_ceil(k) / 2);
274274
auto A = dft<base>(std::views::take(a, k), n);
275-
if(size(a) < k) {
275+
if(size(a) != k) {
276276
a.resize(k);
277277
}
278278
if(a == b) {
@@ -282,7 +282,9 @@ namespace cp_algo::math::fft {
282282
}
283283
}
284284
void mul(auto &a, auto const& b) {
285-
mul_truncate(a, b, std::max(size_t(0), size(a) + size(b) - 1));
285+
if(size(a) || size(b)) {
286+
mul_truncate(a, b, size(a) + size(b) - 1);
287+
}
286288
}
287289
void circular_mul(auto &a, auto const& b) {
288290
mul_truncate(a, b, std::max(size(a), size(b)));

verify/poly/pow.test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// @brief Pow of Power Series
22
#define PROBLEM "https://judge.yosupo.jp/problem/pow_of_formal_power_series"
3+
#pragma GCC optimize("Ofast,unroll-loops")
34
#include "cp-algo/math/poly.hpp"
45
#include <bits/stdc++.h>
56

0 commit comments

Comments
 (0)