Rosetta Problems

Organizing Branching Shelves

https://atcoder.jp/contests/awc0085/tasks/awc0085_d