Editorial for DMOPC '14 Exam Time P4 - Exam Delay


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

By Eduard Ionescu

The solution to this problem is to implement Dijkstra's Shortest Path Algorithm, which allows you to determine the shortest path in a weighted graph with non-negative edges. Since our definition of the shortest path is the least amount of time required, the travel-time for each edge (road) is calculated. Remember to keep track of the number of edges required to reach every node – and to take the minimum value if the time required to reach a node via different paths is the same.

\mathcal{O}((E+V) \log V), using a binary heap


Comments

There are no comments at the moment.