P3037 [USACO11DEC]Simplifying the Farm G[最小生成树]
前言 \(Kruscal\) 的进一步应用以及 \(set\) 去重应用,输入输出没翻译,练习一下英语水平吧 (其实是懒得搞) (逃 题目描述 Farmer John has been taking an evening algorithms course at his local university, and he has just learned about minimum spanning trees. However, Farmer John now realizes that the design of his farm is not as efficient as it could be, and he wants to simplify the layout of his farm. The farm is currently arranged like a graph, with vertices representing fields and edges representing pathways between these fields, each having an associated length. Farmer John notes that for each distinct length, at most three pathways on his