British Informatics Olympiad 2012 Question 1