Problem 1614. -- [Ceoi2000]Roads

1614: [Ceoi2000]Roads

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 1  Solved: 1
[Submit][Status][Web Board]


The Romanian Ministry of Transport decides to upgrade the Romanian roads. Each road is bidirectional and directly connects two towns. No two towns are directly connected by more than one road. The existing road network ensures direct or indirect links between any two towns in Romania.
However, upgrading the roads implies closing, in turn, each road and performing the ne¬cessary repairs. During these operations, it is necessary to preserve the road network connec¬tivity. In order to do so, the Minister de¬cides that new roads should be built, so that no matter which single road is closed at any given mo¬ment (exactly one road at a time), the traffic between any given pair of towns should still be possible. Of course, the number of these newly added roads should be mi¬ni¬mized. Furthermore, no new road may directly connect two directly connected towns.
Write a program that determines the mi¬ni¬mum number of the additional roads to be built and the pairs of towns to be connected with them. If there are several optimal solutions, only one is required.


Line 1: N M
• two integers, separated by a blank, repre¬sen¬t¬¬ing respectively the number of the towns and the num¬ber of the roads. The towns are labelled from 1 to N.
Lines 2..M+1: T1 T2

• two integers separated by a blank, repre¬sen¬ting the two towns connected by a road.

• 3 < =  N < =  2500
• 2 < =  M < =  20000


Line 1: K
• an integer, representing the mi¬ni¬mum number of additional roads.

Sample Input

4 3
1 2
2 3
2 4

Sample Output