QOJ.ac

QOJ

Límite de tiempo: 2 s Límite de memoria: 512 MB Puntuación total: 100

#10289. Key of Affection

Estadísticas

Toys carry the joy of childhood. Love, weakness, distress, hope... When the sleeping toy box is opened again, what kind of surprises will the treasures brought back to light reveal?

M has such a toy box, a birthday gift from her mother, who is a jewelry designer. Carefully polished gemstones dot the toy box like stars in the night sky, and the box is guarded by $L$ locks of various shapes, protecting her daughter's little universe: flower hairpins, quill pens, letter M-shaped balloons... each item encapsulates a memory of M.

A few days ago, while tidying up her room, M found this toy box and a bunch of keys specially made for it. There are a total of $(L + K)$ keys on the keychain, among which $L$ keys can each open one of the locks, while the remaining $K$ keys are merely decoys to increase the difficulty of brute-force cracking. For convenience, M's mother embedded a different gemstone into each key when designing them, but unfortunately, M has forgotten the correct correspondence.

"So I have to ask everyone for help," M said, placing the keychain on the table.

K picked up the keychain and examined it carefully. "It seems impossible to infer any useful information from the appearance alone; I'm afraid we can only try them one by one."

Although everyone is willing to help M, they feel at a loss when faced with so many keys. Seeing everyone's reaction, T suggested: "Why don't we play a game? Everyone takes turns trying one key, and the person who opens the most locks in the end is the winner."

Including M, a total of $N$ people take turns trying to unlock the toy box in the same order until all $L$ locks are opened. In each turn, a person chooses one key and tries to open one of the locks with it. To open the toy box as quickly as possible, everyone's strategy is to choose the combination of key and lock that maximizes the probability of success for that attempt; if there are multiple combinations with the same maximum probability, one of them is chosen uniformly at random. Obviously, if a key has successfully opened a lock previously, no one will choose the same key or the same lock in subsequent attempts.

Assume that at the very beginning, the probability of any key opening any lock is equal. If everyone can choose the optimal combination to try based on all previously attempted key and lock combinations, what is the expected number of successful unlocks for each person?

Input

The input is read from standard input.

The input consists of a single line containing three non-negative integers $N$ ($1 \le N \le 50$), $L$ ($1 \le L \le 5000$), and $K$ ($0 \le K \le 50$), representing the number of people participating in the game, the number of locks, and the number of fake keys, respectively.

Output

Output to standard output.

Output a single line containing $N$ non-negative integers $E_1, \dots, E_N$, where $E_i$ represents the expected number of successful unlocks for the $i$-th person in the sequence. Clearly, $E_i$ is a rational number; let its simplest fractional form be $p_i/q_i$ (where $p_i$ and $q_i$ are coprime). Then $E_i$ is the integer solution satisfying $q_i E_i \equiv p_i \pmod{10^9 + 7}$ and $0 \le E_i < 10^9 + 7$. It can be proven that under the given constraints, each $E_i$ exists and is unique.

Examples

Input 1

3 1 4

Output 1

800000006 800000006 400000003

Note 1

When there is only 1 lock, everyone's strategy is to randomly choose a key that has not been tried by anyone yet. Since there are a total of $1 + 4 = 5$ keys, the probabilities of each person opening the lock are $2/5, 2/5, 1/5$, which are also the expected numbers of successful unlocks for each person.

Input 2

3 2 0

Output 2

500000004 1 500000004

Note 2

In this case, there are 2 locks and 2 keys, and each key can open exactly one of the locks. Since there is no prior information, the first person can only randomly choose a key and a lock, and the probability of successfully unlocking is $1/2$.

  • If the first person opens the lock, the second person can directly use the other key to open the other lock.
  • If the first person does not open the lock, the key chosen by the first person must correspond to the other lock, and the other key must be able to open the lock chosen by the first person. Based on this information, the second and third people can each open one lock.

In summary, the expected number of successful unlocks for each person is: $E_1 = \frac{1}{2} \times 1 + \frac{1}{2} \times 0 = \frac{1}{2} \equiv 500,000,004 \pmod{10^9 + 7}$, $E_2 = \frac{1}{2} \times 1 + \frac{1}{2} \times 1 = 1$, $E_3 = \frac{1}{2} \times 0 + \frac{1}{2} \times 1 = \frac{1}{2} \equiv 500,000,004 \pmod{10^9 + 7}$.

Input 3

25 2 5

Output 3

142857144 166666668 615646263 639455787 234126986 257936510 195918369 502040820 478316330 81264173 190523433 471438023 23809524 0 0 0 0 0 0 0 0 0 0 0 0

Input 4

4 102 9

Output 4

568832210 85779764 969938175 375449967

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.