POJ 1989(双权值并查集)
Navigation Nightmare Time Limit: 2000MS Memory Limit: 30000K Total Submissions: 8503 Accepted: 3062 Case Time Limit: 1000MS Description Farmer John's pastoral neighborhood has N farms (2 <= N <= 40,000), usually numbered/labeled 1..N. A series of M (1 <= M < 40,000) vertical and horizontal roads each of varying lengths (1 <= length <= 1000) connect the farms. A map of these farms might look something like the illustration below in which farms are labeled F1..F7 for clarity and lengths between connected farms are shown as (n): F1 --- (13) ---- F6 --- (9) ----- F3 | | (3) | | (7) F4 --- (20) ---