Problem 3540 · Medium

Minimum Time to Visit All Houses

Houses sit on a ring with separate costs for each direction; a shortest-path search over (house, queries reached) finds the cheapest tour that hits the queries in order.

Open the interactive visualisation