As the title.
I wrote a comment:"C is too difficult and D is too easy XD" under the lastest round.
Then my comment deleted and my account got a read-only mode for 2 days.
Was my comment against community rules in CodeForces? I didn't know it well,could someone tell me plz
Did you write it before the contest ended? Maybe that is a kind of violation of rules.
Yes may be it is QwQ,thank you. But are there any offical rules?If there are,could you tell me OuO
here
How did you do D? I didn't do C either so I looked at D. I felt in my bones that there was probably some kind of mathematics involved but had no idea what it was.
Use dp.
It is easy to see the steps must be not big,about $$$\sqrt{n}$$$.
Set $$$f_{i,j}$$$ as the answer of $$$i$$$ steps reach $$$j$$$.
$$$f_{i,j}=\sum_{l=1}^{j-1} f_l*[(j-l) \mod (k+i-1) == 0]$$$
Then we can use rolling arrays to optimize the memory and use prefix sum to optimize the time.
Then it is a $$$O(n\sqrt{n})$$$ solution.
Code: 166958668
censorship police