Skip to content

Latest commit

 

History

History
14 lines (11 loc) · 867 Bytes

File metadata and controls

14 lines (11 loc) · 867 Bytes
  • Determine the minimum cost to provide library access to all citizens of HackerLand. There are n cities numbered from 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:

    • Their city contains a library.
    • They can travel by road from their city to a city containing a library.
  • Function Params Description

    • int n: integer, the number of cities
    • int c_lib: integer, the cost to build a library
    • int c_road: integer, the cost to repair a road
    • int cities[m][2]: each cities[i] contains two integers that represent cities that can be connected by a new road
  • Solution