
Sample Input 0
4 3 1 2 72 1 4 96 2 4 80
Sample Output 0
80 0 96
Explanation 0
The best path to city 2 is via city 4. There is no path to city 3.
Sample Input 1
5 6 1 2 70 1 3 75 2 3 80 2 5 72 3 4 65 4 5 70
Sample Output 1
EXPERT ANSWER
Algorithm for the question:
- this is a simple dijkstra algorithm problem
- we have to find the minimum height of the truck that can reach from city 1 to city n
- so we will use dijkstra algorithm to find the minimum height of the truck that can reach from city 1 to city n
- we will use priority queue to find the minimum height of the truck that can reach from city 1 to city n
- we will use a vector of pair to store the graph
- we will use a array to store the minimum height of the truck that can reach from city 1 to city n
- we will use a loop to take input of the graph
- we will use a loop to find the minimum height of the truck that can reach from city 1 to city n
- we will use a loop to print the minimum height of the truck that can reach from city 1 to city n
- time complexity is O(nlogn)
- space complexity is O(n)

