Hi Guys ,small task to you all... sam seeks your help to know the longest run possible with the given peaks. That altitude of different peaks is given by a grid of numbers. Look at this example:
7 2 3 4 5 36 37 38 34 6 33 44 46 40 7 24 43 42 41 8 35 32 47 30 9
One can ski down from one peak to a connected peak if and only if the height decreases. One peak is connected to another if it's at left, at right, above or below it. In the sample map, a possible ski path would be 36-33-24(start at 36, end at 24). Of course if one would ski 46-44-43-42-41-30-9....3-2, it would be a much longer run. In fact, it's the longest possible. There could be more than one longest ski path, but all sam needs from you is to tell maximum number of peaks he could cover for a given map, in this case it is 14. ALL INPUTS comes from input.txt file.