Honey Heist

From programming_contest
Revision as of 20:34, 29 December 2017 by imported>Kmk21
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This problem asks us the number of steps taken to reach a given node on a hexagonal grid.

It is trivially a BFS, but the challenge is that the grid is hexagonal. Fortunately, given that each edge only has max 20 nodes, we can write some code up front to calculate which cells border which others. Then once we have a graph, it's literally a BFS and check the distance to the destination cell