Problem Link ---> https://mirror.codeforces.com/contest/364/problem/E
I've read the editorial, but I'm unable to understand the algo. Can anyone give a better explanation, or some resources to understand this problem. I need to understand this problem, before applying a similar logic to another problem. A similar problem appeared in one of my divid-and-conquer based test, a while ago.
If you're unable to understand a div1. E algorithm, then maybe you should try to solve easier problems.