QOJ.ac

QOJ

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

#6623. 完美匹配

統計

AAA 收到了一份生日礼物,是一个包含 $2n$ 个顶点的完全图,其中每两个不同的顶点之间都由一条唯一的边相连。然而,AAA 认为这个完全图不够美观,于是他决定删去构成一棵树的 $2n - 1$ 条边。

现在他想知道剩余图中不同完美匹配的数量。注意,完美匹配是指包含 $n$ 条边的集合,其中任意两条边都没有公共顶点。由于答案可能非常大,你只需要输出答案对 $998\,244\,353$ 取模的结果。

输入格式

第一行包含一个整数 $n$ ($2 \le n \le 2\,000$)。

接下来的 $2n - 1$ 行,每行包含两个整数 $u$ 和 $v$ ($1 \le u, v \le 2n$),表示从完全图中删除的一条边。保证给定的边构成一棵包含 $2n$ 个顶点的树。

输出格式

输出一行,包含一个整数,表示答案对 $998\,244\,353$ 取模的结果。

样例

样例输入 1

2
1 2
1 3
3 4

样例输出 1

1

样例输入 2

3
1 2
2 3
3 4
4 5
5 6

样例输出 2

5

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.