I am currently solving this [Problem](https://codeforces.net/problemset/problem/1197/D) and I am not able to understand its [editorial](https://codeforces.net/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.