We Need More Bosses

题意翻译

**题目大意:** 给定一个 $n$ 个点 $m$ 条边的无向图,保证图连通。找到两个点$s,t$,使得$s$到$t$**必须**经过的边最多(一条边无论走哪条路线都经过ta,这条边就是必须经过的边),$2<=n<=3*10^5,1<=m<=3*10^5$ **输入格式:** 第一行两个整数,$n,m$ 以下m行,每行两个整数$x,y$,表示$xy$间有一条无向边相连 **输出格式:** 一个整数,即最多的必须经过边数 感谢@守望 提供翻译

题目描述

Your friend is developing a computer game. He has already decided how the game world should look like — it should consist of $ n $ locations connected by $ m $ two-way passages. The passages are designed in such a way that it should be possible to get from any location to any other location. Of course, some passages should be guarded by the monsters (if you just can go everywhere without any difficulties, then it's not fun, right?). Some crucial passages will be guarded by really fearsome monsters, requiring the hero to prepare for battle and designing his own tactics of defeating them (commonly these kinds of monsters are called bosses). And your friend wants you to help him place these bosses. The game will start in location $ s $ and end in location $ t $ , but these locations are not chosen yet. After choosing these locations, your friend will place a boss in each passage such that it is impossible to get from $ s $ to $ t $ without using this passage. Your friend wants to place as much bosses as possible (because more challenges means more fun, right?), so he asks you to help him determine the maximum possible number of bosses, considering that any location can be chosen as $ s $ or as $ t $ .

输入输出格式

输入格式


The first line contains two integers $ n $ and $ m $ ( $ 2 \le n \le 3 \cdot 10^5 $ , $ n - 1 \le m \le 3 \cdot 10^5 $ ) — the number of locations and passages, respectively. Then $ m $ lines follow, each containing two integers $ x $ and $ y $ ( $ 1 \le x, y \le n $ , $ x \ne y $ ) describing the endpoints of one of the passages. It is guaranteed that there is no pair of locations directly connected by two or more passages, and that any location is reachable from any other location.

输出格式


Print one integer — the maximum number of bosses your friend can place, considering all possible choices for $ s $ and $ t $ .

输入输出样例

输入样例 #1

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

输出样例 #1

2

输入样例 #2

4 3
1 2
4 3
3 2

输出样例 #2

3