hello, Recently i was solving this problem below: http://codeforces.me/contest/540/problem/E
I made a survey in my college.Many couldn't do it.I have shown them EDITORIAL too.But many couldn't understand how to solve that finally.Many were confused in a lot ways. So,Today i request GUYS who solved this problem,to spare some time on this QUERY which would be useful for many students who are breaking their heads on this problem's logic. Please spare time and post nice explaination with example,so that it would be more clear. AND i REQUEST not to give DOWNVOTE this post,Because this post is REALLY USEFUL for many CODERS....Many get stuck in this kind of problems,,and due to (some not better explaination)..they skip that problem having good concept... SO,GUYS PLEASE POST NICE EXPLAINATION FOR THIS PROBLEM,,, NOTE:IT IS NOT NEEDED THAT YOU UPVOTE THIS POST(BUT DONT DOWN VOTE).......WE NEED TO LEARN CONCEPT... THANKS IN ADVANCE....HOPE I WOULD SEE MANY REPLIES HELPING MANY CODERS WHO FEEL THIS CONCEPT HARD....
One of the best things about Codeforces is that you can view any submission. If you do not understand the editorial, you will find at least 200 AC codes ( except for rare occurences), sometimes 1000-2000 in different languages, and different solutions ideas.
You will definitely find some well written codes in these, just read them, it won't be easy and you will not understand the concept in few seconds, but in the end you will.
If you do not understand the editorial, and not any code, given you have spent a good time, Most probably this problem is out of your zone, attempt it later. ( but make sure you do), or you might create a thread in this case, explaining parts you do not understand in the solution.