s66104444 @ 2017-10-01 15:47:40
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int a[102][102];
int f[102][102];
bool jilu[102][102];
int r,c;
int dp(int b,int c)
{
if(jilu[b][c]) return f[b][c];
jilu[b][c]=1;
int tp=0;
if(b+1<=r&&a[b][c]>a[b+1][c]) tp=max(tp,dp(b+1,c));
if(b-1>=1&&a[b][c]>a[b-1][c]) tp=max(tp,dp(b-1,c));
if(c+1<=c&&a[b][c]>a[b][c+1]) tp=max(tp,dp(b,c+1));
if(c-1>=1&&a[b][c]>a[b][c-1]) tp=max(tp,dp(b,c-1));
f[b][c]=tp+1;
return f[b][c];
}
int main()
{
cin>>r>>c;
memset(f,0,sizeof(f));
for(int i=1;i<=r;i++)
{
for(int j=1;j<=c;j++)
{
cin>>a[i][j];
}
}
int ans=0;
for(int i=1;i<=r;i++)
{
for(int j=1;i<=c;j++)
{
ans=max(ans,dp(i,j));
}
}
cout<<ans;
return 0;
}
by x402 @ 2017-10-29 17:26:11
变量名重复了啊