#P7440. 「KrOI2021」Feux Follets
「KrOI2021」Feux Follets
Background
Note: , and among all satisfying , this is the only number that is congruent to modulo .
Problem Description
Let be the number of cycles in the permutation when (of length ) is viewed as a permutation mapping. Given two integers and a polynomial of degree , for each , compute:
where ranges over all permutations of length such that there is no position with .
Input Format
The first line contains two integers, denoting and .
The second line contains integers, giving the coefficients of the polynomial from low degree to high degree.
Output Format
Output one line with integers, denoting the answers modulo .
3 2
0 1
0 1 2
6 4
11 43 27 7
0 88 176 1311 7332 53070
6 4
9 72 22 7
0 110 220 1551 8580 60990
Hint
Constraints
For of the testdata, .
Translated by ChatGPT 5