#P8107. [Cnoi2021] 未来试题
[Cnoi2021] 未来试题
Description
You are given two positive integers .
For all , when generating a uniformly random permutation of length , compute the probability that the number of inversions in the permutation modulo has remainder . Output the answers modulo .
Input Format
One line containing two integers .
Output Format
One line containing integers separated by spaces. The -th integer represents the probability that the number of inversions in the permutation modulo has remainder .
4 5
166374059 166374059 457528662 748683265 457528662
Hint
Sample Explanation
| Number of inversions | Permutations |
|---|---|
| 0 | |
| 1 | |
| 2 | |
| 3 | $(1,4,3,2)(2,3,4,1)(2,4,1,3)(3,1,4,2)(3,2,1,4)(4,1,2,3)$ |
| 4 | |
| 5 | |
| 6 |
Constraints
For of the testdata, it is guaranteed that , .
Re-collected from XDUCPC 2021 Onsite Contest F.
Translated by ChatGPT 5
京公网安备 11011102002149号