QOJ.ac

QOJ

مجموع النقاط: 100

#9474. 彩色节点

الإحصائيات

有 $N$ 个带颜色的节点,编号从 $1$ 到 $N$。初始时,节点 $i$ 的颜色为 $i$。节点之间存在 $M$ 条边。 在第 $(i + kN)$ 分钟开始时,与节点 $i$ 相邻的节点的颜色将被设置为与节点 $i$ 相同的颜色,其中 $k$ 是非负整数。

以下图片展示了示例。

第 1 分钟

第 2 分钟

第 3 分钟

第 4 分钟

第 5 分钟

第 6 分钟

在第 1 分钟开始时,节点 2 的颜色被设置为 1。 在第 2 分钟开始时,节点 1 和 5 的颜色被设置为 1。 在第 3 分钟开始时,节点 4 和 5 的颜色被设置为 3。 在第 4 分钟开始时,节点 3 和 5 的颜色被设置为 3。 在第 5 分钟开始时,节点 2、3 和 4 的颜色被设置为 3。 在第 6 分钟开始时,节点 2 的颜色被设置为 1。 ……

假设在第 $j$ 分钟颜色为 $i$ 的节点数量为 $D(i, j)$。并假设

$$F(i) = \lim_{n \to \infty} \frac{1}{n} \sum_{j=1}^{n} D(i, j)$$

你的任务是计算所有 $i$ 在 $1$ 到 $N$ 范围内的 $F(i)$。

输入格式

输入包含多组测试数据。(最多 20 组) 对于每组测试数据: 第一行包含两个整数 $N$ 和 $M$,表示节点数和边数。$(1 \le N, M \le 10^5)$ 接下来 $M$ 行,每行包含两个整数 $a$ 和 $b$,表示节点 $a$ 和节点 $b$ 之间存在一条边。$(1 \le a, b \le N)$

输出格式

对于每组测试数据,输出所有满足 $F(i) \neq 0$ 的 $F(i)$,保留六位小数,并按降序排列。

样例

输入 1

5 5
1 2
2 5
3 4
4 5
3 5

输出 1

3.000000
2.000000

输入 2

5 4
1 2
2 5
5 4
4 3

输出 2

2.800000
2.200000

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.