Please also specify the map is a full free usable rectangle, there could be objects in the middle of the playground making the snails slow down or forcing them to avoid the cell/obstacle in further episodes
Are you rounding anywhere in your solution?
A rather straightforward puzzle - after reading this discussion and making some assumptions that I would not have to worry about:
- any obstacles (there are none - and, to be fair, the statement does not say there would be any, though the phrasing
where a snail can go
made me assume there were also places where it could not go); - snails occupying the same space (it is possible);
- snails knowing their destination or simply picking
a path closest to it
(it is the former: snails know where to go to, so they pick the smallest path to any destination rather than any available path closest to the snail).