#P3225. [HNOI2012] 矿场搭建
[HNOI2012] 矿场搭建
Description
A coal mining site can be viewed as an undirected graph where tunnels connect mining points. For safety, we want that in case of an accident, all miners at the remaining mining points can have a way out to reach a rescue exit. Therefore, the owner decides to set up rescue exits at some mining points so that no matter which single mining point collapses, workers at all other mining points still have a path to a rescue exit.
Please write a program to compute the minimum number of rescue exits required, as well as the total number of distinct configurations that achieve this minimum.
Input Format
The input file contains multiple test cases.
For each test case, the first line contains a positive integer , the number of tunnels.
Each of the next lines contains two integers and separated by a space, indicating that mining point is directly connected to mining point by a tunnel.
The input ends with a single .
Output Format
For each test case, output one line.
The -th test case output starts with (note the letter case; there is a space between and , no space between and , and there is one space after ).
After that, output two space-separated positive integers: the first is the minimum number of rescue exits required for the -th test case, and the second is the number of distinct configurations achieving this minimum.
The testdata guarantees the answer is less than . Refer to the sample input and output format.
9
1 3
4 1
3 5
1 2
2 6
1 5
6 3
1 6
3 2
6
1 2
1 3
2 4
2 5
3 6
3 7
0
Case 1: 2 4
Case 2: 4 1
Hint
Sample Explanation
- The four solutions for Case 1 are , , , .
- One solution for Case 2 is .
Constraints
For each test case, let be the maximum value among all and in that case. Then:
- .
- The set of vertices formed by all and values is .
- The graph induced by is connected.
Translated by ChatGPT 5
京公网安备 11011102002149号