QOJ.ac

QOJ

Time Limit: 2.5 s Memory Limit: 512 MB Total points: 100 Hackable ✓

#9844. Harie 编程竞赛

Statistics

公元 9102 年,有 $n$ 名学生在 Harie 大学可穿戴技术实验室(简称 WTLab)工作。每名学生都自认为是“Ninniku Homan”(NH)或“Siege Guy”(SG)中的一种。

Nikuniku 想要在他们中间组织一种新型编程竞赛,每支队伍由两名成员组成——一名 NH 和一名 SG。学生们不允许自行选择队友。相反,他们提出组队意向,由 Nikuniku 决定最终的队伍。学生 $x$ 和 $y$ 之间的意向意味着他们愿意合作。由于在 WTLab 不诚实的惩罚非常高,因此保证这些意向是有效的,即 $x$ 和 $y$ 中一个是 Siege Guy,另一个是 Ninniku Homan,但不会同时是同一种身份。不过,Nikuniku 并不知道谁是 NH,谁是 SG。

Nikuniku 希望以一种方式安排队伍,使得她的竞赛能有尽可能多的队伍。然而,为了维持实验室关键基础设施的运行,她必须预留两名学生以备紧急情况。不幸的是,这两名预留的学生不能参加比赛。

但 Nikuniku 不想妥协——她仍然希望队伍数量与所有 $n$ 名学生都参加时一样多。Nikuniku 想知道,有多少种选择这两名预留学生的方法,使得她不需要做出妥协。

输入格式

第一行包含两个由空格分隔的整数 $n$ ($2 \le n \le 2 \cdot 10^5$) ——学生人数,以及 $m$ ($0 \le m \le 2 \cdot 10^5$) ——意向数量。

接下来的 $m$ 行,每行包含两个整数 $x$ ($1 \le x \le n$) 和 $y$ ($1 \le y \le n, x \neq y$),表示 $x$ 和 $y$ 之间存在一个组队意向。

保证意向是唯一的,即对于任何给定的 $x$ 和 $y$,它们之间最多只有一个意向。

输出格式

输出一行一个整数——Nikuniku 问题的答案。

样例

样例输入 1

6 4
1 2
1 3
4 5
4 6

样例输出 1

4

样例输入 2

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

样例输出 2

5

样例输入 3

5 4
1 2
2 3
3 4
4 5

样例输出 3

0

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.