#K63637. Minimum Rounds to Disseminate Information

    ID: 31798 Type: Default 1000ms 256MiB

Minimum Rounds to Disseminate Information

Minimum Rounds to Disseminate Information

You are given a network of (N) computers, numbered from (1) to (N), and a list of bidirectional connections between them. In one round, any computer that has the information can share it with all of its direct neighbors simultaneously. Initially, computer (1) has the information. Your task is to determine the minimum number of rounds required so that every computer in the network receives the information. It is guaranteed that the network is connected.

inputFormat

The input is given from standard input (stdin) in the following format:\ The first line contains an integer (N) (the number of computers).\ The second line contains an integer (M) (the number of connections).\ Each of the following (M) lines contains two space-separated integers (u) and (v), representing a bidirectional connection between computer (u) and computer (v).

outputFormat

Output a single integer to standard output (stdout), which is the minimum number of rounds required for every computer to receive the information.## sample

3
2
1 2
2 3
2

</p>