Hello codeforces,
I am not able to understand the editorial for this question.
Can someone please explain the approach to this problem more clearly?
Editorial link : http://agc002.contest.atcoder.jp/data/agc/002/editorial.pdf
Problem link : http://agc002.contest.atcoder.jp/tasks/agc002_d