Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
set solution in Clear category for Power Supply by gyahun_dash
def power_supply(network, plants):
connections = tuple(map(set, network))
cities = set.union(*connections)
for plant, power in plants.items():
supplied = {plant}
for distance in range(power):
supplied.update(*filter(supplied.intersection, connections))
cities -= supplied
return list(cities)
Dec. 9, 2016
Comments: