I'm getting WA in this 449B this is my submission
i implemented the dijkstra's algorithm to find shortest path between the capital and each city , and the result is stored in dist[] .
could anyone point out the problem , or tell me if my idea is wrong ??
Did you considered that maybe the shortest path between capital and a city will use one train route and some other roads?
No because the statement inform that train's routes can only connect a city and the capital directly and not 2 cities .
The shortest path between 1 and X could be a train route between 1 and Y and then a path(the shortest path) between Y and X...
i got it , i will work on that . Thanks !!