Lost in Translation

From programming_contest
Revision as of 22:37, 2 November 2017 by imported>Kmk21 (Created page with "This problem asks us to calculate the cost incurred by taking the fewest-hops path from a given node to every other node. Fewest hops is just running BFS, and we use cost as...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This problem asks us to calculate the cost incurred by taking the fewest-hops path from a given node to every other node.

Fewest hops is just running BFS, and we use cost as a tiebreaker. We also store the cost used to reach each node on the fewest hops path. That is what we need to print out at the end