Logo
(追記) (追記ここまで)

25693번 - Tree 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 (추가 시간 없음) 1024 MB111100.000%

문제

We generate two rooted trees with $n$ vertices in the following way.

The first tree is generated as follows:

  1. Vertex 1ドル$ is the root of the tree.
  2. For all $i \in [2, n],ドル we select one vertex from $[1, i - 1]$ as the father of $i$.

The second tree is generated as follows:

  1. Vertex $n$ is the root of the tree.
  2. For all $i \in [1, n - 1],ドル we select one vertex from $[i + 1, n]$ as the father of $i$.

A way to generate the trees is good if and only if every vertex $i$ which is a leaf in tree 1ドル$ is not a leaf in tree 2ドル,ドル and every vertex $i$ which is not a leaf in tree 1ドル$ is a leaf in tree 2ドル$. The root of every tree is not a leaf, regardless of the number of adjacent edges.

Now for all $n \in [2, N],ドル calculate the number of good ways to generate trees. Two ways are considered different if and only if there exists a vertex $i$ such that the parent of $i$ in at least one tree is different in these two ways. You should output the answer modulo $M$.

입력

The first line of input contains two integers $N$ and $M$ (2ドル \leq N \leq 500,ドル 10ドル \leq M \leq 2^{30}$).

출력

Output $N-1$ lines: the answers for $n = 2, 3, \ldots, N$.

제한

예제 입력 1

5 998244353

예제 출력 1

1
2
12
120

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2022 > Day 5: ZJU Contest 2 B번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /