Rosetta Problems

Segtree☆Magica

https://atcoder.jp/contests/tkppc4-2/tasks/tkppc4_2_f