#OLD132. 1Consecutive longest descending sequence
1Consecutive longest descending sequence
Description
AA likes to ski because skiing is really exciting. However, in order to gain speed, the sliding area must be tilted downwards, and when you slide to the bottom of the hill, you have to go uphill again or wait for the lift to load you. AA wants to know the longest bottom landslide in one area. The area is given by a two-dimensional array. Each number in the array represents the height of the point. Below is an example
1 2 3 4 5
16 17 18 19 6
15 24 25 20 7
14 23 22 21 8
13 12 11 10 9
AA can slide down to one of the four adjacent of down,up,left,right points and only if the height decreases. In the above example, a glideable landslide is 24-17-16-1. Of course 25-24-23-...-3-2-1 is longer. In fact, this is the longest one.
Format
Input
There are multiple test cases. Each case contains two integers N, M (1<=N, M<=1000) .Followed by N lines, each line contains M integers which separated by space.
Output
For each test case, output the length of the longest route.
Samples
5 5
1 2 3 4 5
16 17 18 19 6
15 24 25 20 7
14 23 22 21 8
13 12 11 10 9
25