AtCoder Regular Contest 165
E
Random Isolation
AtCoder
⌀ 2783
原题
← DF →
翻译中…

Problem Statement

翻译中…

There is a tree with $N$ vertices numbered $1$ to $N$. The $i$-th edge connects vertices $A_i$ and $B_i$.

翻译中…

Let us keep performing the following operation until each connected component of the graph has $K$ or fewer vertices.

翻译中…
  • From the $N$ vertices, choose one uniformly at random that belongs to a connected component with $K+1$ or more vertices. Delete all edges with the chosen vertex as an endpoint.
翻译中…

Find the expected value of the number of times the operation is performed, modulo $998244353$.

翻译中…

How to print an expected value modulo $\text{mod }{998244353}$ It can be proved that the sought expected value is always a rational number. Additionally, under the constraints of this problem, it can also be proved that when that value is represented as an irreducible fraction $\frac{P}{Q}$, we have $Q \not \equiv 0 \pmod{998244353}$. Thus, there is a unique integer $R$ such that $R \times Q \equiv P \pmod{998244353}, 0 \leq R < 998244353$. Report this $R$.

翻译中…

Constraints

翻译中…
  • $1 \leq K < N \leq 100$
  • $1 \leq A_i,B_i \leq N$
  • The given graph is a tree.
  • All input values are integers.
翻译中…

Input

翻译中…

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

翻译中…

N K
A_1 B_1
A_2 B_2
\vdots
A_{N-1} B_{N-1}

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
4 2
1 2
2 3
2 4
Output #1
249561090
For example, if the first operation chooses vertex $2$, it deletes all edges, after which each connected component has not more than two vertices, so we finish performing the operation. On the other hand, if the first operation chooses vertex $1$, there will still be a connected component with vertices $2$, $3$, and $4$, so we perform the second operation. The expected value of the number of operations is $\frac{7}{4}$.
Input #2
20 10
16 8
6 2
18 3
3 12
5 1
13 9
13 19
3 11
5 13
17 6
8 14
1 16
16 20
11 15
3 10
15 4
5 18
1 7
1 17
Output #2
181196154
题目信息
题号
arc165_e
时间限制
2 s
内存限制
1024 MB

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