Help required in CF div 2 round 503 Problem C

Can someone help me in this question? I am unable to understand the editorial.
Thanks!