Problem Link ---> https://codeforces.net/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.