| TeamsCode Summer 2022 Contest |
|---|
| Finished |
This is the easy version. The difference between the easy version and the hard version is the constraints.
Misaka Imouto $$$1$$$, Misaka Imouto $$$2$$$, ..., and Misaka Imouto $$$n$$$ are all playing rock paper scissors to determine who should go buy the cake. Since they are all connected to the same network, let's assume that all Misaka Imouto's act the same.
A game of rock paper scissors is dictated as follows:
One possible game between $$$3$$$ Misaka Imouto's could be as follows: RPS, RRS, SSX, SRX, and ending with the second Misaka winning after $$$4$$$ rounds. In this game, R means rock, S means scissors, P means paper, and X means that this Misaka Imouto has lost already and was not allowed to play.
For each $$$i$$$ from $$$1$$$ to $$$n$$$, find the expected number of rounds a game with $$$i$$$ Misaka Imoutos initially lasts.
The input contains two numbers $$$n$$$ and $$$P$$$, $$$(2 \leq n \leq 10^4, 10^{8} \leq P \leq 10^{9})$$$. It is guaranteed that $$$P$$$ is a prime.
For tests $$$1 - 4$$$, $$$(2 \leq n \leq 50)$$$ will be satisfied.
For tests $$$5 - 8$$$, $$$(2 \leq n \leq 3366)$$$ will be satisfied.
The remaining test data do not satisfy any additional constraints.
Output $$$n$$$ integers, the $$$i$$$'th integer denoting the expected number of rounds a game with $$$i$$$ Misakas initially will last.
So for each $$$i$$$ from $$$1$$$ to $$$n$$$, let the final expected number of rounds of a game with $$$i$$$ Misaka Imoutos be $$$\frac{x_i}{y_i}$$$, output $$$z_i$$$ $$$(0 \leq z_i \lt P)$$$ where $$$x_i \equiv y_i \cdot z_i \pmod P$$$.
5 100000007
0 50000005 25000004 64285722 25714292
$$$50000005$$$ is also $$$\frac{3}{2} \mod 100000007$$$
$$$25000004$$$ is also $$$\frac{9}{4} \mod 100000007$$$
—
Idea: 3366
Preparation: 3366
Occurrences: Intermediate 10, Advanced 4
| Name |
|---|


