传送门 按照题意模拟维护最小的环套树森林就行了。 然而考试的时候naivenaivenaive瞎写了一个错误的贪心。代码 转载于:https://www.cnblogs.com/ldxcaicai/p/10084879.html