Sunday, 15 April 2012

Google Code Jam 2012 - My solutions for the qualification round

I participated and managed to find reasonable solutions for A,B C en D-small. I code in Python, as its compactness and focus on sets, dicts and lists are great for coding challenges like these.

They read input from stdin, so a command like
cat input | python program.py
prints the output to your terminal.

A - Speaking in Tongues



B - Dancing With the Googlers


C - Recycled Numbers


D - Hall of Mirrors

I'm not proud of this solution, but it got the job done. It's not elegant and it only works for the small set. (The only mirrors are the ones on the sides).

It works by tiling mirrored versions of the original map to cover.