UVA12671 Disjoint water supply

Description

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=602&page=show_problem&problem=4409 [PDF](https://uva.onlinejudge.org/external/126/p12671.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12671/8ccd605884f1527d8dd9e994c133918001525f8f.png)

Input Format

![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12671/19ab5d02faaa72de0b1de474025040dd8a4ad00b.png)

Output Format

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