[Solution] Long Way Home Codeforces Solution
Stanley lives in a country that consists of cities (he lives in city ). There are bidirectional roads between some of the cities, and you know how long it takes to ride through each of them. Additionally, there is a flight between each pair of cities, the flight between cities and takes time.
Stanley is quite afraid of flying because of watching "Sully: Miracle on the Hudson" recently, so he can take at most flights. Stanley wants to know the minimum time of a journey to each of the cities from the city .
In the first line of input there are three integers , , and (, , ) — the
number of cities, the number of roads, and the maximal number of flights Stanley can take.
The following lines describe the roads. Each contains three integers , , (, , ) — the cities the road connects and the time it takes to ride through. Note that some pairs of cities may be connected by more than one road.
Print integers, -th of which is equal to the minimum time of traveling to city .
No comments:
Post a Comment