AtCoder Grand Contest 066
E
Sliding Puzzle On Tree
AtCoder
⌀ 2950
原题
← DF →
翻译中…

Problem Statement

翻译中…

You are given a tree with $N$ vertices numbered $1$ to $N$. The $i$-th edge of the tree connects vertices $u_i$ and $v_i$.

翻译中…

For each $K=1, 2, \ldots, N$, solve the following problem:

翻译中…

There are $K$ stones numbered $1, 2, \ldots, K$, with the stone numbered $i$ placed on vertex $i$. You can repeatedly perform the following operation:

  • Choose two vertices $u$ and $v$ connected by an edge such that $u$ has a stone on it and $v$ does not. Move the stone from $u$ to $v$.

Find the number, modulo $998244353$, of possible configurations of the stones after performing the operations. Two configurations are distinguished if and only if there is a stone whose position differs between those configurations.

翻译中…

$T$ test cases are given; solve each of them.

翻译中…

Constraints

翻译中…
  • $1\leq T\leq 10^5$
  • $1\leq N\leq 2\times 10^5$
  • $1\leq u_i, v_i\leq N$
  • The given graph is a tree.
  • The sum of $N$ over all test cases in a single input is at most $2\times 10^5$.
翻译中…

Input

翻译中…

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

翻译中…

T
\text{case}_1
\vdots
\text{case}_T

翻译中…

Each test case is given in the following format:

翻译中…

N
u_1 v_1
\vdots
u_{N-1} v_{N-1}

翻译中…

Output

翻译中…

Print $T$ lines. The $i$-th line should contain the answers for $K=1, 2, \ldots, N$ for the $i$-th test case, separated by spaces.

翻译中…

样例

Input #1
1
4
1 2
1 3
1 4
Output #1
4 12 4 1
Let us represent the configuration of stones by the sequence of vertices where the stones numbered $1, 2, \ldots, K$ are placed. - For $K=1$, there are $4$ possible configurations: $(1), (2), (3), (4)$. - For $K=2$, there are $12$ possible configurations: $(1,2), (1,3), (1,4), (2,1), (2,3), (2,4), (3,1), (3,2), (3,4), (4,1), (4,2), (4,3)$. - For $K=3$, there are $4$ possible configurations: $(1,2,3), (4,1,3), (4,2,1), (4,2,3)$. - For $K=4$, there is $1$ possible configuration: $(1,2,3,4)$. For $K=3$, refer to the following figure. ![image](https://img.atcoder.jp/agc066/f2dc57ae01aa4f1ccb51c1a2b8fe7d15.png)
Input #2
4
1
5
1 4
5 2
3 4
2 1
7
1 7
2 7
5 6
4 1
1 6
3 6
10
1 2
2 3
3 4
4 5
5 6
2 7
3 8
4 9
5 10
Output #2
1
5 10 10 5 1
7 42 210 840 84 7 1
10 90 720 5040 30240 151200 604800 720 10 1
The tree given in each test case is as follows: ![image](https://img.atcoder.jp/agc066/744a8d907603331334518cc5d7b62bb9.png)
题目信息
题号
agc066_e
时间限制
2 s
内存限制
1024 MB

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