Can anyone of you please provide some better explanation of http://mirror.codeforces.com/contest/449/problem/D than the explanation given in the editorial (http://mirror.codeforces.com/blog/entry/13112). I am new to such stuff so I am not good at grasping the concepts as other smart people are.