Successful solution of problem http://www.codechef.com/MAY14/problems/OJUMPS