Home | I n t e r n e t C o n t e s t | i n t e r n e t c o n t e s t |
C E O I 2 0 0 0 |
Regulations Schedule Organising Team Cluj&Romania Sponsors Secretariat Internet Contest Links
|
Problem 2 : Roads 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 necessary repairs. During these operations, it is necessary to preserve the road network connectivity. In order to do so, the Minister decides that new roads should be built, so that no matter which single road is closed at any given moment (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 minimized. Furthermore, no new road may directly connect two directly connected towns. Task Write a program that determines the minimum 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 File name: ROADS.IN Line 1: N M Lines 2..M+1: T1 T2 Output File name: ROADS.OUT Line 1: K Lines 2..K+1: C1 C2 Remark Limits Example ROADS.IN ROADS.OUT 4 3 2 1 2 1 4 2 3 1 3 2 4 |
||