Least Crucial Node
题目链接:
http://acm.hust.edu.cn/vjudge/contest/127401#problem/C
Description
http://7xjob4.com1.z0.glb.clouddn.com/e15d7d11650607e5795d28e1120d7109
There are several input lines to a test case. The first line of each test case contains an integer n
(2 ≤ n ≤ 100), where n is the number of nodes (vertex set of G) labeled with {1, 2, . . . , n} in the
network. The second line contains an integer, which is the label of the unique sink of the network. The
third line contains an integer m, indicating the number of communication links in the network. The
next m lines each contains a pair of integers, say i and j (separated by a space), denoting there is a
communication link (edge in E) between node i and node j. There are at most 10 test cases and n = 0
denotes end of the test cases.
Output
The output for each instance should contain an integer denoting the least crucial node in the given
network.
4
4
3
1 2
2 3
3 4
6
3
8
1 2
2 3
2 4
2 5
3 4
3 5
4 5
5 6
0
Sample Output
3
2
##题意:
求标号最小的最大割点.
(删除该点后,指定点#sink能到达的点数减少最多).
##题解:
由于数据规模巨水,直接对枚举各点跑一遍并查集(或dfs)计算删除后的减少量.
(不要对源点#sink跑并查集,因为割点不能是#sink).
##代码:
``` cpp
#include
#include
#include
#include
#include
#include
#include