Rosetta Problems

宝探し 2

https://atcoder.jp/contests/code-festival-2014-morning-hard/tasks/code_festival_morning_hard_c