I am trying to solve this problem : http://www.spoj.com/problems/AMR11A/
Here is a link to my solution http://ideone.com/8ebZDj
I am first using the usual dp method of finding best path through a 2D matrix and then moving back on the path t0 find the lowest energy point on my selected path.
I am getting Wrong answer