Skip to content

Commit f841a34

Browse files
committed
fix
1 parent 24b7295 commit f841a34

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

atcoder/convolution.hpp

+8-4
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ void butterfly(std::vector<mint>& a) {
7777
a[i + offset] = l + r;
7878
a[i + offset + p] = l - r;
7979
}
80-
if (s + 1 != (1 << len)) rot *= info.rate2[bsf(~(unsigned int)(s))];
80+
if (s + 1 != (1 << len))
81+
rot *= info.rate2[bsf(~(unsigned int)(s))];
8182
}
8283
len++;
8384
} else {
@@ -102,7 +103,8 @@ void butterfly(std::vector<mint>& a) {
102103
a[i + offset + 2 * p] = a0 + na2 + a1na3imag;
103104
a[i + offset + 3 * p] = a0 + na2 + (mod2 - a1na3imag);
104105
}
105-
if (s + 1 != (1 << len)) rot *= info.rate3[bsf(~(unsigned int)(s))];
106+
if (s + 1 != (1 << len))
107+
rot *= info.rate3[bsf(~(unsigned int)(s))];
106108
}
107109
len += 2;
108110
}
@@ -132,7 +134,8 @@ void butterfly_inv(std::vector<mint>& a) {
132134
irot.val();
133135
;
134136
}
135-
if (s + 1 != (1 << len)) irot *= info.irate2[bsf(~(unsigned int)(s))];
137+
if (s + 1 != (1 << (len - 1)))
138+
irot *= info.irate2[bsf(~(unsigned int)(s))];
136139
}
137140
len--;
138141
} else {
@@ -163,7 +166,8 @@ void butterfly_inv(std::vector<mint>& a) {
163166
(a0 + (mint::mod() - a1) + (mint::mod() - a2na3iimag)) *
164167
irot3.val();
165168
}
166-
if (s + 1 != (1 << len)) irot *= info.irate3[bsf(~(unsigned int)(s))];
169+
if (s + 1 != (1 << (len - 2)))
170+
irot *= info.irate3[bsf(~(unsigned int)(s))];
167171
}
168172
len -= 2;
169173
}

0 commit comments

Comments
 (0)