2011 Multi-Univ Training Contest #3 Problem C The King's Problem