Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convolution is wrong in some case #30

Closed
kotatsugame opened this issue Sep 12, 2020 · 1 comment
Closed

convolution is wrong in some case #30

kotatsugame opened this issue Sep 12, 2020 · 1 comment

Comments

@kotatsugame
Copy link

kotatsugame commented Sep 12, 2020

m=641 ( =2^7*5+1, prime ) and |A| = |B| =61 ( 2^6<|A|+|B|-1=121<2^7 ), convolution returns wrong result.
I think this for-loop's condition should be i <= cnt2 - 2.

for (int i = 0; i < cnt2 - 2; i++) {

@yosupo06
Copy link
Collaborator

Yes, your pointing is correct. I'll fix this, thanks for reporting!

yosupo06 added a commit that referenced this issue Sep 13, 2020
fix #30: convolution is broken in edge-cases
Hiromi-Ayase added a commit to Hiromi-Ayase/AtCoderLibraryForJava that referenced this issue Jul 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants