CF1000E.We Need More Bosses

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Your friend is developing a computer game. He has already decided how the game world should look like — it should consist of nn locations connected by mm 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 ss and end in location tt , 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 ss to tt 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 ss or as tt .

输入格式

The first line contains two integers nn and mm ( 2n31052 \le n \le 3 \cdot 10^5 , n1m3105n - 1 \le m \le 3 \cdot 10^5 ) — the number of locations and passages, respectively.

Then mm lines follow, each containing two integers xx and yy ( 1x,yn1 \le x, y \le n , xyx \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 ss and tt .

输入输出样例

  • 输入#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
    
首页