切断圆环链 Cutting Chains

题意翻译

现在有n个圆环 ,其中可能有些已经连接在一起 现在你想拆开一些圆环与其他圆环连接,使得最后所有圆环都在一条串上 问至少需要拆开几个圆环 (n≤15) 感谢 @songhn 提供的翻译。

题目描述

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=10&page=show_problem&problem=759 [PDF](https://uva.onlinejudge.org/external/8/p818.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA818/9588cba436e36fdf85fd844a054493144c71cd89.png)

输入输出格式

输入格式


![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA818/821cc5792a65cc72d2d0454f5be79a922e908729.png)

输出格式


![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA818/de0f05a76005d5842d5a31d5c281cf7842612760.png)

输入输出样例

输入样例 #1

5 1 2 2 3 4 5 -1 -1
7 1 2 2 3 3 1 4 5 5 6 6 7 7 4 -1 -1
4 1 2 1 3 1 4 -1 -1
3 1 2 2 3 3 1 -1 -1
3 1 2 2 1 -1 -1
0

输出样例 #1

Set 1: Minimum links to open is 1
Set 2: Minimum links to open is 2
Set 3: Minimum links to open is 1
Set 4: Minimum links to open is 1
Set 5: Minimum links to open is 1