I got all the test cases mentioned in the question and cases given as counter cases in the forum also correct.And i tried many test cases of mine.And seems like correct to me.but still getting wrong answer.Can anyone please tell whats wrong with my program or give any counter test case.
This is the question
Here is my solution
http://www.codechef.com/viewsolution/2188218
Thanx alot