How to crack this problem? Can anyone help me with Logic and the code?
I guess the editorial would work : http://discuss.codechef.com/questions/1284/download-editorial