ac-library-rs icon indicating copy to clipboard operation
ac-library-rs copied to clipboard

u32 modulo fix

Open mizar opened this issue 2 years ago • 7 comments

https://github.com/rust-lang-ja/ac-library-rs/issues/111

Fix a problem with cases like 2^31 < modulo < 2^32 due to poor implementation of ac-library's overflow/underflow check.

mizar avatar Jan 20 '23 23:01 mizar

Rebased commit to current rust-lang-ja:master.

mizar avatar Jan 22 '23 03:01 mizar

AtCoder Library Practice Contest F - Convolution before: 239ms https://atcoder.jp/contests/practice2/submissions/38240676 after: 242ms https://atcoder.jp/contests/practice2/submissions/38240720

mizar avatar Jan 22 '23 05:01 mizar

@mizar Does this fix correspond to a PR in atcoder/ac-library, or is this an original improvement?

TonalidadeHidrica avatar Mar 30 '23 13:03 TonalidadeHidrica

@TonalidadeHidrica https://github.com/atcoder/ac-library/issues/149 I have sent an issue to ac-library, but have not yet sent a pull request.

mizar avatar Apr 10 '23 10:04 mizar

This proposed change has been incorporated into ACL 1.5.1 and is expected to be available in the 202301 language update for C++.

  • https://github.com/atcoder/ac-library/issues/149
  • https://github.com/atcoder/ac-library/pull/163
  • https://github.com/atcoder/ac-library/releases/tag/v1.5.1
  • AtCoder 2023/1 Language Update > 要確認事項

    2023/04/12 新ジャッジアップデートと共にACLのアップデートも予定しています。新バージョンは v1.5.1 です。 release はこちら https://github.com/atcoder/ac-library/releases/tag/v1.5.1

mizar avatar Apr 15 '23 06:04 mizar

Regarding the proposed 2^31 <= m < 2^32 response to ModInt addition and subtraction, the response was as follows.

https://github.com/atcoder/ac-library/issues/164#issuecomment-1514700101

Thanks for suggestion, but we don't have a plan to extend mod range to m < 2^32. As far as I know, at least 99% usage of modint is m < 2^31. TBH I don't came up any recent problems that requires 2^31 < m < 2^32. So, we prefer to prepare m < 2^31 modint rather than m < 2^32 modint with tricky technique.

mizar avatar Apr 19 '23 14:04 mizar