#include<iostream> using namespace std; ; }; }; int dp(int,int); int row,col; int main() { while(cin>>row>>col) { int i,j; ; ;i<=row;++i) ;j<=col;++j) cin>>map[i][j]; ;i<=row;++i) ;j<=col;++j) { )mar[i][j] = dp(i,j); if(max < mar[i][j])max = mar[i][j]; } cout<<max<<endl; } ; } int dp(int i,int j) { )return mar[i][j]; ,xia=,zuo=,you=; >= && map[i-][j]<map[i][j])shang = +dp(i-,j); ; <= row && map[i+][j]<map[i][j])xia = +dp(i+,j); ; >= && map[i][j-]<map[i][j])zuo = +dp(i,j-); ; <= col && map[i][j+]<map[i][j])you = +dp(i,j+); ; shang = shang > xia?shang:xia; shang = shang > zuo?shang:zuo; shang = shang > you?shang:you; return shang; }