Module 16 · The STL in Competitive Programming: Which Container for Which Problem
Dijkstra: Roads, Current Distances, and Stale Heap Entries
ProReading
David delivers books along one-way roads. Each road takes a known nonnegative number of minutes. The road with the smallest individual cost need not belong to the quickest whole journey. He needs the cheapest complete route from the library to every destination.
Checking what this lesson needs for you…
What is inside Dijkstra: Roads, Current Distances, and Stale Heap Entries
- Store roads beside their starting node
- Distances are current claims
- Pop the smallest distance, then check freshness
- Why settling is safe
- The full directed shortest-path program
- Costs follow successful relaxations
- Several sources use the same loop
- Adapt the transition only after proving it