QOJ.ac

QOJ

Límite de tiempo: 6 s Límite de memoria: 1024 MB Puntuación total: 100

#6379. LaLa 与怪物狩猎(第二部分)

Estadísticas

在魔法城市沙利亚(Sharia)附近的森林中,人们目击到了一只可怕的怪物,一群英勇的冒险者打算在它伤害任何人之前将其猎杀。然而,LaLa 知道这些冒险者愿意冒险的真正原因是想获得怪物肠道中产出的稀有魔法石。LaLa 想在他们之前得到这块魔法石,因为它非常美丽。

目前,LaLa 对怪物的位置有一个大致的估计。然而,怪物擅长伪装,因此当它隐藏在分支网络中时,很难将其猎杀。

为了简化起见,我们将怪物建模为一个包含 6 个顶点的图 $G$,如下图所示:

分支网络可以建模为一个简单图 $H$。一个“候选者”是 $H$ 的一个同构于 $G$ 的子图。换句话说,它是通过删除 $H$ 中的一些边,然后删除所有不与剩余边关联的顶点,使得剩余部分可以通过重编号与 $G$ 完全重合的图。LaLa 现在必须检查所有可能的候选者来搜索并猎杀怪物。

编写一个程序,计算 LaLa 需要检查的候选者数量,结果对 $998\,244\,353$ 取模。

输入格式

输入描述了分支网络 $H$,格式如下:

$N$ $M$ $u_0$ $v_0$ $u_1$ $v_1$ $\vdots$ $u_{M-1}$ $v_{M-1}$

其中 $N$ 是连接点的数量,编号从 $0$ 到 $N-1$,$M$ 是分支的数量,第 $i$ 个分支连接连接点 $u_i$ 和 $v_i$。

输入满足以下约束:

  • 输入中的所有数字均为整数。
  • $2 \le N \le 100\,000$
  • $0 \le M \le 100\,000$
  • 对于所有 $0 \le i < M$,满足 $0 \le u_i < v_i < N$
  • 对于所有 $0 \le i < j < M$,满足 $u_i \neq u_j$ 或 $v_i \neq v_j$

注意:网络不一定是连通的。

输出格式

输出应为一个单一整数,表示候选者的数量,对 $998\,244\,353$ 取模。

样例

样例输入 1

6 7
0 1
1 2
0 2
2 3
3 4
4 5
3 5

样例输出 1

4

样例输入 2

6 15
0 1
0 2
0 3
0 4
0 5
1 2
1 3
1 4
1 5
2 3
2 4
2 5
3 4
3 5
4 5

样例输出 2

360

说明

下图展示了第一个样例测试中分支网络的 4 个候选者(实线边):

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.