10986

Single source shortest path algorithm and priority_queue used to solve the problem.