QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 16 MB Points totaux : 100

#261. 管道

Statistiques

在 Cahoots 的土地上,Lomikel 是管道之神。他掌管着输水管道、排水管、下水道,甚至可能是地铁隧道。Cahoots 人在众多的神圣泉水处供奉他,这些泉水由巨大的仪式性管道网络连接。每根管道直接连接两个泉水。

每逢节日,至高水管工(Lomikel 祭司中地位最高者)都会进行复杂的仪式,涉及通过管道输送水。

有时,Lomikel 的愤怒会导致管道破裂,因此水管工必须使用其他管道让水绕过破裂的管道。这并不总是可能的——对于某些管道,不存在其他路径。这些管道被称为“关键管道”,水管工必须特别注意它们。你可以在下图中看到用粗线绘制的关键管道。

你的任务是读取网络描述并找出所有关键管道。然而,该网络非常庞大,且你只有有限的内存。此任务的内存限制仅为 16 MB。

输入格式

标准输入的第一行包含两个空格分隔的整数 $N$ 和 $M$。其中 $N$ 是泉水的数量 ($1 \le N \le 100\,000$),$M$ 是管道的数量 ($1 \le M \le 6\,000\,000$)。

接下来的 $M$ 行,每行描述一根管道。它包含两个空格分隔的整数 $u$ 和 $v$ ($1 \le u, v \le N$),表示该管道连接的两个泉水。

两个泉水之间可以有多根管道连接,但单根管道的两个端点始终是不同的泉水。

技术说明:标准输入支持 seek 操作(例如回退到开头),但解决此任务不需要 seek。此外,多次读取输入可能太慢。

输出格式

标准输出由一系列行组成。每一行描述一根关键管道,包含两个空格分隔的整数:管道的两个端点。

关键管道可以以任意顺序排列,单根管道的两个端点也可以以任意顺序排列。

样例

样例输入 1

10 11
1 7
1 8
1 6
2 8
6 7
5 8
2 5
2 3
2 4
3 4
10 9

样例输出 1

1 8
9 10

子任务

共有 10 组测试数据,每组 10 分。各组测试数据的参数上限如下表所示。

组别 1 2 3 4 5 6 7 8 9 10
$N$ 的上限 100 5 000 4 000 10 000 30 000 70 000 80 000 100 000 100 000 100 000
$M$ 的上限 200 15 000 600 000 1 200 000 1 500 000 2 000 000 3 000 000 4 000 000 5 000 000 6 000 000

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.