https://codeforces.com/contest/1385/problem/F

Please help me with this problem .I am unable to understand the code given in the editorial.

Maybe this could help Submission #87198725 - Codeforces