MatKor Cup Seat Arrangement
Time limit2sMemory limit1024 MB
Given N participants and M seats, find for each i from 0 to N the probability that exactly i participants are predicted to sit in their assigned seat.
- Level
Medium6 of 10
- Topics
- Combinatorics, Math
- Solved
- No attempts yet
Problem
This MatKor Cup has participants in total, and the contest hall has seats. Jongwoo assigned each of the participants a different seat in advance. Dongwoo asked Jongwoo how the seats were assigned.
Jongwoo would not simply tell him. Instead, he asked Dongwoo to predict the seat of each of the participants. Dongwoo chose different seats out of the seats, then predicted the seat of each participant.
For each , find the probability that exactly of the predicted participants were predicted to sit in the same seat that Jongwoo assigned to them.
Jongwoo and Dongwoo assign and predict seats with equal probability over all possible cases.
Input
The first line contains the number of participants and the number of seats, and (), separated by a space.
Output
Print the answer on a single line modulo . Print numbers, from to , separated by spaces. Note that you must print all values, from 0 to , separated by spaces.
Let be an irreducible fraction with , , and . Its value modulo is , where is the modular multiplicative inverse of modulo , meaning . If the fraction is an integer, then , so the value is .
It can be proven that under the given conditions, each probability is an integer or a rational number whose denominator is not a multiple of .