Codeforces celebrates 10 years! We are pleased to announce the crowdfunding-campaign. Congratulate us by the link https://codeforces.com/10years. ×

### RetiredAmrMahmoud's blog

By RetiredAmrMahmoud, 3 years ago, ,

So recently I was trying to solve this problem 100965F - Polynomial, the following blog contains spoilers.

The first approach was trying to represent the polynomial as x * (x + 1) * ... * (x + m — 1) and get the result using divide and conquer and FFT multiplication in which didn't fit in the time limit. So the second approach is to print just the polynomial which will give 0 but only for x coprime with m, but surprisingly it got accepted.

So how is this correct? and also how the checker for this problem is written?

• +16

 » 3 years ago, # |   +24 By CRT, we can consider every prime power in the factorization of m separately. Now note that:xm - xm - φ(m) = xm - φ(m)(xφ(m) - 1)If x is coprime with p, then the right factor is 0. If x is not coprime with p, then from the fact that m - φ(m) is greater than the exponent of p, then the left factor is 0. So the polynomial is 0 in every point.
•  » » 3 years ago, # ^ |   +8 Thanks for your explanation.Do you have any idea how the checker could've been written? just interested :D