I am unable to understand the solution of this question.
Question link : https://codeforces.com/problemset/problem/160/D
Solution link : https://codeforces.com/contest/160/submission/35835930
I basically want to the intuitive approach behind this. I have given this solution link because it has been submitted by most of the users.
If there is any other approach or solution other than this, Please explain that one as I just want to know approach so that I can code.