时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 1024 M,其他语言2048 M
Special Judge, 64bit IO Format: %lld
题目描述
There is an undirected graph where each vertex has a unique weight

.
Initially, a chess piece is placed on a vertex. In each move, the piece moves to the adjacent vertex with the smallest weight. If all adjacent vertices have weights greater than the current vertex, the movement stops immediately.
You can freely assign weights

to the vertices (ensuring they are all unique) and choose the initial position of the chess piece. Your goal is to maximize the number of vertices visited by the chess piece.
输入描述:
The first line contains two positive integers
.
The next
lines each contain two positive integers
, indicating an edge in the graph.
输出描述:
Output a single integer, which is the maximum number of vertices visited by the chess piece.
示例2
输入
复制
6 8
4 6
1 6
4 5
5 6
2 5
2 4
2 6
3 5
备注:
.