stop_count stops numbered 0 to stop_count - 1. The list roads describes the roads: [u, v, t] is a two-way road between stops u and v that takes t units of time to travel. A pair of stops may be joined by several roads, and the city may fall apart into disconnected pieces.
Stop i closes at time closing[i]: you can only get there strictly before that moment, and a closed stop cannot be passed through.
You start at stop 0 at time 0. Return a list holding, for every stop, the earliest time you can get there, or -1 if it cannot be reached in time.stop_count=4, roads=[[0, 1, 3], [1, 2, 2], [0, 2, 7], [2, 3, 1]], closing=[5, 4, 6, 10] → [0, 3, 5, 6]
Stop 1 is reached at 3 (it closes at 4, in time), stop 2 via stop 1 at 3 + 2 = 5 (closes at 6), stop 3 one unit later at 6.
stop_count=4, roads=[[0, 1, 3], [1, 2, 2], [0, 2, 7], [2, 3, 1]], closing=[5, 3, 6, 10] → [0, -1, -1, -1]
We would reach stop 1 exactly as it closes, which is too late. The direct road to stop 2 takes 7, but it closes at 6. With stops 1 and 2 lost, stop 3 is out of reach.
stop_count=3, roads=[], closing=[2, 2, 2] → [0, -1, -1]
There are no roads, so only the starting stop is reachable.
stop_count=4, roads=[[0, 1, 3], [1, 2, 2], [0, 2, 7], [2, 3, 1]], closing=[5, 4, 6, 10]
[0, 3, 5, 6]
Run checks the first 3 tests in your browser. Submit checks all 106 tests on the server, hidden ones included.