QOJ.ac

QOJ

Límite de tiempo: 2 s Límite de memoria: 32 MB Puntuación total: 100

#11057. 封锁

Estadísticas

Byteotia 共有 $n$ 个城镇。一些城镇之间由双向道路连接。城镇之外没有交叉路口,但可能存在桥梁、隧道和立交桥。每对城镇之间最多只有一条直接道路。从任何一个城镇都可以直接或间接地到达其他任何城镇。

每个城镇恰好有一名居民。因此,居民们感到孤独。事实证明,每位居民都希望拜访其他所有居民(在对方的家乡),并且每人恰好拜访一次。因此,总共应该进行 $n\cdot (n-1)$ 次拜访。没错,本应如此。不幸的是,程序员们正在举行大罢工,要求紧急采购软件。作为抗议行动,程序员们计划封锁 Byteotia 的一个城镇,禁止进入、离开该城镇,甚至禁止经过该城镇。目前,他们正在讨论选择哪个城镇,以便造成的后果最为严重。

请编写一个程序:

  • 从标准输入读取 Byteotia 的道路系统描述,
  • 对于每个城镇,确定如果该城镇被程序员封锁,有多少次拜访将无法进行,
  • 将结果输出到标准输出。

输入格式

标准输入的第一行包含两个正整数:$n$ 和 $m$ ($1 \le n \le 100\,000$, $1 \le m \le 500\,000$),分别表示城镇数量和道路数量。城镇编号从 $1$ 到 $n$。接下来的 $m$ 行包含道路描述。每行包含两个整数 $a$ 和 $b$ ($1 \le a < b \le n$),表示编号为 $a$ 和 $b$ 的城镇之间有一条直接道路。

输出格式

你的程序应向标准输出写入恰好 $n$ 个整数,每行一个。第 $i$ 行应包含如果程序员封锁了第 $i$ 号城镇,将无法进行的拜访次数。

样例

输入 1

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

输出 1

8
8
16
14
8

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.