ユニークビジョンプログラミングコンテスト2023 秋 (AtCoder Beginner Contest 323)
G
Inversion of Tree
AtCoder
⌀ 3091
原题
翻译中…

Problem Statement

翻译中…

You are given a permutation $P=(P_1,P_2,\ldots,P_N)$ of $(1,2,\ldots,N)$.

翻译中…

For each $K=0,1,\ldots,N-1$, find the number, modulo $998244353$, of trees with $N$ vertices numbered $1$ to $N$ that satisfy the following condition.

翻译中…
  • Among the pairs of vertices $(u_i,v_i)\ (u_i < v_i)$ that are directly connected by an edge in the tree, exactly $K$ pairs satisfy $P_{u_i}>P_{v_i}$.
翻译中…

Constraints

翻译中…
  • $2\leq N\leq 500$
  • $P$ is a permutation of $(1,2,\ldots,N)$.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N
P_1 P_2 \ldots P_N

翻译中…

Output

翻译中…

For each $K=0,1,\ldots,N-1$, print the number, modulo $998244353$, of trees that satisfy the condition, with spaces in between.

翻译中…

样例

Input #1
3
1 3 2
Output #1
1 2 0
The answer for $K=0$ is $1$: the tree with edges connecting vertices $1,2$ and $1,3$. Indeed, $P_1 < P_2$ and $P_1P_3$.
Input #2
10
3 1 4 10 8 6 9 2 7 5
Output #2
294448 2989776 12112684 25422152 30002820 20184912 7484084 1397576 108908 2640
题目信息

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。