Problem
Determine the minimum cost to provide library access to all citizens of HackerLand. There are n cities numbered from to 1 to n. Currently there are no libraries and the cities are not connected. Bidirectional roads may be built between any city pair listed in cities.
A citizen has access to a library if:
a) Their city contains a library.
b) They can travel by road from their city to a city containing a library.