File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -289,23 +289,24 @@ namespace cp_algo::math::fft {
289
289
return cyclic_mul (a, make_copy (b), k);
290
290
}
291
291
void mul (auto &a, auto &&b) {
292
- size_t N = size (a) + size (b) - 1 ;
293
- if (N > (1 << 19 )) {
292
+ size_t N = size (a) + size (b);
293
+ if (N > (1 << 20 )) {
294
+ N--;
294
295
size_t NN = std::bit_ceil (N);
295
296
a.resize (NN);
296
297
b.resize (NN);
297
298
cyclic_mul (a, b, NN);
298
299
a.resize (N);
299
300
} else {
300
- mul_truncate (a, b, N);
301
+ mul_truncate (a, b, N - 1 );
301
302
}
302
303
}
303
304
void mul (auto &a, auto const & b) {
304
- size_t N = size (a) + size (b) - 1 ;
305
- if (N > (1 << 19 )) {
305
+ size_t N = size (a) + size (b);
306
+ if (N > (1 << 20 )) {
306
307
mul (a, make_copy (b));
307
308
} else {
308
- mul_truncate (a, b, N);
309
+ mul_truncate (a, b, N - 1 );
309
310
}
310
311
}
311
312
}
You can’t perform that action at this time.
0 commit comments