UVa 908 - Re-connecting Computer Sites

Problem Number - Problem Name

 * http://uva.onlinejudge.org/external/9/908.html

Summary
Given a set of N edges of a tree, output the total cost of this tree. Then given another set of K+M edges, construct an MST using these edges and output its cost.

Gotchas
Just a naive MST constructing problem. Nothing special to consider

Input
5 1 2 5 1 3 5 1 4 5 1 5 5 1 2 3 2 6 1 2 5 1 3 5 1 4 5 1 5 5 3 4 8 4 5 8

4 1 2 5 1 3 5 1 4 5 1 2 3 2 4 1 2 5 1 3 5 1 4 5 3 4 8

Output
20 20

15 12