What is wrong in my Naive approach?

This coding question was a part of my college competition and i am happy that i was able to solve 4 out of 5 questions. This discuss belongs to the 5th question “The Mountaineer”.

Link: Programming Problems and Competitions :: HackerRank

Any one can signup as the competition was already over and i am enthusiastic about this question.
Please mention the tips to solve this question.

My Naive approach is wrong.