Rosetta Problems

Catch the Last Train!

https://atcoder.jp/contests/awc0014/tasks/awc0014_c