Hello guys
I am not able to understand the editorial solution for the given problem: https://atcoder.jp/contests/abc155/tasks/abc155_f
Editorial: https://img.atcoder.jp/abc155/editorial.pdf (Last Page).
It seems a standard and interesting problem. Any kind of hint/solution will be much appreciated.