Skip to content

Commit 8f96ad5

Browse files
committed
Fix
1 parent be6314c commit 8f96ad5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

cp-algo/math/poly.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,17 @@ namespace cp_algo::math {
4343
normalize();
4444
return *this;
4545
}
46-
poly_t& div_xk_inplace(size_t k) {
47-
a.erase(begin(a), begin(a) + std::min(k, size(a)));
46+
poly_t& div_xk_inplace(int64_t k) {
47+
if(k < 0) {
48+
return mul_xk_inplace(-k);
49+
}
50+
a.erase(begin(a), begin(a) + std::min<size_t>(k, size(a)));
4851
normalize();
4952
return *this;
5053
}
5154
poly_t mod_xk(size_t k) const {return poly_t(*this).mod_xk_inplace(k);}
5255
poly_t mul_xk(size_t k) const {return poly_t(*this).mul_xk_inplace(k);}
53-
poly_t div_xk(size_t k) const {return poly_t(*this).div_xk_inplace(k);}
56+
poly_t div_xk(int64_t k) const {return poly_t(*this).div_xk_inplace(k);}
5457

5558
poly_t substr(size_t l, size_t k) const {return poly::impl::substr(*this, l, k);}
5659

0 commit comments

Comments
 (0)