#K57447. Hard to Reach Cities
Hard to Reach Cities
Hard to Reach Cities
Given N cities and M one-way roads, your task is to identify the cities that are hard to reach from the headquarters (city 1). A city \(i\) (with \(2 \leq i \leq N\)) is considered hard to reach if the shortest travel time from city 1, denoted by \(d_i\), strictly satisfies \(d_i > T\), where \(T\) is a given threshold. The travel time between cities is determined by the sum of weights along the roads. Use Dijkstra's algorithm to compute the shortest path efficiently.
inputFormat
The input is provided via standard input (stdin) with the following format:
The first line contains three integers: \(N\) (the number of cities), \(M\) (the number of one-way roads), and \(T\) (the travel time threshold).
Each of the next \(M\) lines contains three integers \(u\), \(v\), and \(w\) representing a one-way road from city \(u\) to city \(v\) with travel time \(w\>.
outputFormat
Output the city numbers that are hard to reach in increasing order, separated by a space. If no city meets the criteria, output the string "NONE".
## sample5 6 10
1 2 4
1 3 8
2 3 2
2 4 5
3 4 1
4 5 6
5