Since the post mortem thread in A3 was kinda interesting lets have a go at the other two problems as well
This problem was an interesting one for me, I figured its a threading contest, i bet we get to use threads! However the best solution seemed to be single threaded. (Weird!)
The best optimalisation I could come up with was a lookup table for every 5x5 block on the field you could determine the inner 9 cells by just looking in a big ass table, turning this problem from a heavy test problem into a simple lookup problem. and by running a single 5x5 block it was easy to determine possible spots to move to in the next cycle. One last optimalisation was to check the current cell's location compared to the target cell and try the possible directions that would get us closer (or atleast in the right direction) to the target cell first.
I kinda misread or mis understood the problem description and figured there would be more points for performance then for the 'shortest' route (boy was that a mistake) and opted to have a go at trying to be fastest, looking back yeah big mistake, but hey on timing points alone still got 12 points out of it.
(warning due to the lookup table download is about 16 megs)


