atcoder#ARC104D. [ARC104D] Multiset Mean

[ARC104D] Multiset Mean

Score : 700700 points

Problem Statement

Given positive integers N,KN, K and MM, solve the following problem for every integer xx between 11 and NN (inclusive):

  • Find the number, modulo MM, of non-empty multisets containing between 00 and KK (inclusive) instances of each of the integers 1,2,3,N1, 2, 3 \cdots, N such that the average of the elements is xx.

Constraints

  • 1N,K1001 \leq N, K \leq 100
  • 108M109+910^8 \leq M \leq 10^9 + 9
  • MM is prime.
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN KK MM

Output

Use the following format:

c1c_1

c2c_2

::

cNc_N

Here, cxc_x should be the number, modulo MM, of multisets such that the average of the elements is xx.

3 1 998244353
1
3
1

Consider non-empty multisets containing between 00 and 11 instance(s) of each of the integers between 11 and 33. Among them, there are:

  • one multiset such that the average of the elements is k=1k = 1: {1}\{1\};
  • three multisets such that the average of the elements is k=2k = 2: {2},{1,3},{1,2,3}\{2\}, \{1, 3\}, \{1, 2, 3\};
  • one multiset such that the average of the elements is k=3k = 3: {3}\{3\}.
1 2 1000000007
2

Consider non-empty multisets containing between 00 and 22 instances of each of the integers between 11 and 11. Among them, there are:

  • two multisets such that the average of the elements is k=1k = 1: {1},{1,1}\{1\}, \{1, 1\}.
10 8 861271909
8
602
81827
4054238
41331779
41331779
4054238
81827
602
8