答案的统计应该是
sum-k*need
而不是
sum-k*cnt
注:k 是白边加的边权,sum 是 wqs二分 的 check 中白边加 k 时的 MST 权值和,cnt 是 check 中选的白边数量。