#T186. 滑雪

滑雪

Description

Xiao Ming loves skiing because it's truly exhilarating. However, to gain speed, the skiing area must slope downward. Once Xiao Ming reaches the bottom of the slope, he has to either climb back up or wait for a helicopter to pick him up. Xiao Ming wants to know the longest possible ski path within a given area. The length of the ski path is determined by the number of points traversed. The area is represented by a two-dimensional array where each number indicates the elevation of a point. Here's an example:
Skiing.jpg
A person can ski from a point to one of the four adjacent points (up, down, left, or right) if and only if the elevation decreases. In the example above, a feasible ski path is 25-24-17-16-1 (starting at 25 and ending at 1). Of course, 25-24...2-1 is even longer, and in fact, this is the longest possible path.

Input Format

The first line of input contains two integers, R and C, representing the number of rows and columns of the two-dimensional array (1 ≤ R, C ≤ 100). The following R lines each contain C numbers representing the elevations.

Output Format

Output the length of the longest ski path in the area.

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