Rosetta Problems

Iroha and a Grid

https://atcoder.jp/contests/arc058/tasks/arc058_b