WA in REVERSE NEED HELP

Could someone please explain or provide a hint or a test case where my solution might be failing. Thanks a ton in advance.

https://www.codechef.com/viewsolution/53903111