QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 512 MB مجموع النقاط: 100

#3015. 双团

الإحصائيات

给定一个包含 $n$ 个节点和 $m$ 条边的无向图 $G$。设顶点集合为 $V$,边集合为 $E$。

定义 $G$ 的补图为 $G'$。补图 $G'$ 与原图 $G$ 拥有相同的节点,但对于任意两个节点 $a$ 和 $b$,如果它们在 $G$ 中没有边相连,则在 $G'$ 中有边相连;如果它们在 $G$ 中有边相连,则在 $G'$ 中没有边相连。

团(Clique)是指图中一个节点子集,其中任意两个节点之间都有边相连。如果一个节点子集 $S$ 满足 $S$ 在 $G$ 中构成一个团,且 $V - S$ 在 $G'$ 中也构成一个团,则称 $S$ 为双团(Double Clique)。注意,空集也被视为一个团。

给定一个图,请计算该图中双团的数量,结果对 $10^9 + 7$ 取模。

输入格式

每个输入包含一个测试用例。注意,你的程序可能会在不同的输入上多次运行。每个测试用例的第一行包含两个整数 $n$ 和 $m$ ($1 \le n, m \le 2 \times 10^5$),其中 $n$ 是节点数,$m$ 是边数。节点编号为 $1 \dots n$。接下来的 $m$ 行,每行包含两个整数 $a$ 和 $b$ ($1 \le a < b \le n$),表示节点 $a$ 和 $b$ 之间有一条边。保证给出的边是唯一的。

输出格式

输出一个整数,表示图中双团的数量,结果对 $10^9 + 7$ 取模。

样例

样例输入 1

3 3
1 3
1 2
2 3

样例输出 1

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.