COGS 2294. [Hzoi 2015] release (FFT mod any prime) __fft

Source: Internet
Author: User
Tags modulus
Topic Description Transmission Door

Title: To two times bounded by N polynomial, the product of the two polynomials, output of the first x of the 0 items to the n-1 of the coefficient mod 23333333

The NTT can only find the value under the FFT modulus. For any modulus problem, we can select three FFT modules to do the NTT, and finally the Chinese remainder theorem to merge.
After the first convolution, each number can reach 1023 (N∗MOD2) 10^{23} (n*mod^2), so we need to select the FFT modulus of three product greater than 1023 10^{23}. When merging 1023>264 10^{23}>2^{64}, we can not use the Chinese remainder theorem directly, need a little skill.
ANS≡A1 (mod M1) ans\equiv A1 \space (Mod\space M1)
ANS≡A2 (mod m2) ans\equiv a2 \space (mod \space m2)
ANS≡A3 (mod m3) ans\equiv a3\space (mod \space m3)
The Ans≡a (mod m) ans\equiv A \space (mod \space m) is obtained by merging the A1,A2 A1,A2 with the Chinese remainder theorem.
of which a=a1∗m2∗m2−1+a2∗m1∗m1−1,m=m1∗m2 a=a1*m2*m2^{-1}+a2*m1*m1^{-1},m=m1*m2
Ans=k∗m+a=x∗m3+a3 ANS=K*M+A=X*M3+A3
K∗m≡a3−a (mod m3) k*m\equiv a3-a \space (mod \space m3)
K≡ (a3−a) ∗m−1 (mod m3)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.