Problem 1614. -- [Ceoi2000]Roads

1614: [Ceoi2000]Roads

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

Description

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.
王国有个公路网,每个路是双向连通两个CITY的.没有哪两个CITY是被多于一条路连接的,公路网保证任两个CITY是连通的.
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.
现在要对现行的公路网进行修整,于是某些道路就不能用了.为了避免出现这种情况,政府决定再建立一些Road
保证不管从前哪些Road在修整,任两个CITY仍是连通的.当然要建的新路越少越好,而且不与现存的路重合.
Task
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.

Input

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.

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

Output

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

2
//建立下面两条路
1-->4
1-->3

HINT

Source

[Submit][Status]