WALK getting WA

Can somebody give me a test case for which my code is incorrect?please!!!
My code is very short and I am sure it will not take much time to debug that code.So, please help me.
My code-http://www.codechef.com/viewsolution/4238280

In my code I was only considering only maximum and the last number,where I should also have to consider the numbers in between.
Here most important thing is the index of the number no matter whether the number is small or large.Here the index plays a crucial role.

//