297 传统题

[CF1000E] 最多必经 Boss 边 (We Need More Bosses)

时间限制
2000ms
内存限制
256MiB
登顶 / 尝试
1/ 1
难度
5

[CF1000E] 最多必经 Boss 边 (We Need More Bosses)

Problem Statement

A game world consists of nn locations and mm bidirectional passages forming a simple connected undirected graph.

Choose a start location ss and an end location tt so as to maximize the number of passages that must be traversed on every path from ss to tt, and print this maximum number.

Input

The first line contains nn and mm (2≤n≤3⋅1052 \le n \le 3 \cdot 10^5, n−1≤m≤3⋅105n - 1 \le m \le 3 \cdot 10^5). The next mm lines each contain x,yx, y (1≤x,y≤n,x≠y1 \le x, y \le n, x \ne y).

Output

Print the maximum possible number of must-traverse passages.

Example

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

Note

  • Constraints:2≤n≤3⋅1052 \le n \le 3 \cdot 10^5,n−1≤m≤3⋅105n - 1 \le m \le 3 \cdot 10^5,图简单连通。
  • Source:Codeforces 1000E · We Need More Bosses