QOJ.ac

QOJ

実行時間制限: 5.0 s メモリ制限: 1024 MB 満点: 100 ハック可能 ✓

#10215. Gona Guni

統計

给定一棵包含 $N$ 个节点的树。你可以从树中选择一个非空的节点集合 $S$。请从树中构建一个包含集合 $S$ 中所有节点的最小连通子图 $G$。

定义 $cost(S) = G$ 的最小点覆盖的大小。

注意,图的最小点覆盖是指包含图中每条边的至少一个端点,且大小尽可能小的顶点集合。

你需要求出所有可能的集合 $S$ 的 $cost(S)^M$ 之和,结果对 $998244353$ 取模。

说明:单节点图的最小点覆盖大小为 $0$。

输入格式

第一行包含一个整数 $T(1 \le T \le 3000)$,表示测试用例的数量。对于每个测试用例,第一行包含两个由空格分隔的整数 $N(1 \le N \le 3 \cdot 10^5)$ 和 $M(0 \le M \le 200)$。接下来 $N - 1$ 行,每行包含两个由空格分隔的整数 $U$ 和 $V$,表示节点 $U$ 和 $V$ 之间的一条边 $(1 \le U, V \le N)$。所有测试用例的 $N$ 之和不超过 $3 \cdot 10^5$。

输出格式

对于每个测试用例,输出一行,表示结果对 $998244353$ 取模后的值。

样例

输入 1

2
3 1
1 2
1 3
20 200
1 2
1 3
2 4
1 5
5 6
1 7
6 8
6 9
3 10
4 11
6 12
11 13
4 14
13 15
15 16
6 17
13 18
15 19
13 20

输出 1

4
286430678

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.