Rosetta Problems

不便な橋

https://atcoder.jp/contests/tkppc4-1/tasks/tkppc4_1_f