QOJ.ac

QOJ

Límite de tiempo: 3 s Límite de memoria: 1024 MB Puntuación total: 100

#5558. 公式平原

Estadísticas

Flatland 很高兴地宣布,今年一级方程式赛车(Formula One)将首次来到 Flatland 举办大奖赛。和许多其他城市一样,Flatland 无法为比赛建造专门的赛道。因此,Flatland 决定封闭一些普通的街道和路口来组成一条赛道。在您出色地完成了去年 Flatland 奥林匹克运动会的组织工作后,您被聘请来寻找一条合适的赛道。由于封闭街道会给当地居民带来困扰,您希望尽量减少比赛所需封闭的路口数量。

图 F.1:第二个样例的可视化。一种可能的最佳赛道是:(4, 5, 7, 6)。

您的工作仅包括选择一些组成圆环但连接路口尽可能少的路段。请注意,尽管 Flatland 的所有道路都是双向的,但出于安全考虑,在比赛期间它们只能单向使用。

输入格式

输入包含: 一行包含两个整数 $n$ 和 $m$ ($4 \le n \le 10^5$ 且 $5 \le m \le 3 \cdot 10^5$),分别表示 Flatland 中的路口数量和路段数量。 $n$ 行,每行包含两个整数 $x$ 和 $y$ ($0 \le x, y \le 10^9$),第 $i$ 行描述了第 $i$ 个路口在 Flatland 地图上的位置。没有两个路口位于同一位置。 * $m$ 行,每行包含两个整数 $a$ 和 $b$ ($1 \le a, b \le n$ 且 $a \neq b$),描述了第 $a$ 个路口和第 $b$ 个路口由一条路段连接。两个路口之间最多由一条路段连接。

保证两条路段仅在它们共同的起点或终点路口处相交。此外,保证地图上的每个路口都对应一个实际的路口,即至少有三条路段在此相交。

输出格式

输出一个整数,表示赛道必须包含的最少路口数量。

样例

输入格式 1

4 6
0 0
3 0
0 3
1 1
1 2
1 3
1 4
2 3
2 4
3 4

输出格式 1

3

输入格式 2

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

输出格式 2

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.