No.3445 Sum of (Tree Distances)^K 2
Problem Statement
You are given positive integers $N, K$.
For each of $a = 1, 2, \dots, N$, solve the following problem.
Define the score of a tree with $N$ vertices numbered $1, 2, \dots, N$ as follows.
- The sum of $\mathrm{dist}(u, v)^{K}$ over all integer pairs $(u, v)$ such that $1\leq u < v\leq N$ and the maximum vertex number among the vertices on the path between vertices $u, v$ is $a$
Here, $\mathrm{dist}(u, v)$ is the number of edges between vertices $u, v$.
Also, define a good tree with $N$ vertices as one satisfying the following condition.
- Every vertex other than vertex $1$ has at least one adjacent vertex with a number smaller than its own.
Find the sum of the scores over all $(N - 1)!$ good trees with $N$ vertices, modulo $998244353$.
Constraints
- $2\leq N\leq 2\times 10^{5}$
- $1\leq K\leq 2\times 10^{5}$
- All input values are integers.
Input
$N\ K$
Output
Output $N$ lines.
On the $i$-th line, output the answer for $a = i$.
Sample
Sample 1
Input
3 1
Output
0 2 6
Consider $a = 3$. There are the following $2$ good trees with $3$ vertices.
- The tree with edges $(1, 2), (2, 3)$
- The tree with edges $(1, 2), (1, 3)$
In either tree, the pairs for which the maximum vertex number on the path is $3$ are the $2$ pairs $(1,3),(2,3)$, and $\mathrm{dist}(1, 3) + \mathrm{dist}(2, 3) = 3$. Therefore, output $3 + 3 = 6$ on the $3$rd line.
Sample 2
Input
4 2
Output
0 6 30 74
Sample 3
Input
16 7
Output
0 972509923 673235942 320468187 122611210 963537619 521784234 840111140 813250073 737360429 805790705 758873901 731500670 364014601 274620614 615217237
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
noya2