QOJ.ac

QOJ

时间限制: 2 s 内存限制: 512 MB 总分: 100

#4651. 偶数树分割

统计

给定一棵包含 $n$ 个节点的无向树。保证 $n$ 是偶数。

你需要删除其中一些边(至少删除 1 条),并使得剩余的每个连通分量都包含偶数个顶点。

计算满足上述条件的删边方案数,结果对 $998244353$ 取模。

输入格式

第一行包含一个整数 $T(1 \le T \le 30)$,表示测试用例的数量。

每个测试用例的第一行包含一个整数 $n(1 \le n \le 10^5)$,表示树的顶点数。

接下来 $n-1$ 行,每行包含两个整数 $u, v(1 \le u, v \le n)$,表示 $u$ 和 $v$ 之间的一条边。

保证输入图是一棵顶点数为偶数的树。

输出格式

对于每个测试用例,输出满足条件的删边方案数,结果对 $998244353$ 取模。

样例

样例输入 1

2
2
1 2
4
1 2
2 3
3 4

样例输出 1

0
1

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.