Rosetta Problems

切符の手配 (Arranging Tickets)

https://atcoder.jp/contests/joisc2017/tasks/joisc2017_d