I am currently solving this [Problem](https://mirror.codeforces.com/problemset/problem/1197/D) and I am not able to understand its [editorial](https://mirror.codeforces.com/blog/entry/68615). Can someone explain it to me in simpler words ? Or if you could share some resources with me which will help me to understand this editorial, that too will be very much helpful.