Hi all, I have been trying to solve this problem from CF #446: http://codeforces.net/contest/891/problem/C . The editorial description of this problem is very bare bones ( atleast that is what I feel) and and after numerous hours looking at comments and other submissions, I have failed to come up with a solution that works. Can anybody please provide a brief procedure on how to go about solving this problem? Thanks in advance.
And if this is not the way to ask for help here, I apologize as I am quite new to codeforces.