Lost in Translation

From programming_contest
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