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 {
289289 return cyclic_mul (a, make_copy (b), k);
290290 }
291291 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--;
294295 size_t NN = std::bit_ceil (N);
295296 a.resize (NN);
296297 b.resize (NN);
297298 cyclic_mul (a, b, NN);
298299 a.resize (N);
299300 } else {
300- mul_truncate (a, b, N);
301+ mul_truncate (a, b, N - 1 );
301302 }
302303 }
303304 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 )) {
306307 mul (a, make_copy (b));
307308 } else {
308- mul_truncate (a, b, N);
309+ mul_truncate (a, b, N - 1 );
309310 }
310311 }
311312}
You can’t perform that action at this time.
0 commit comments