mysterys @ 2023-02-11 12:03:11
by A_Learning_Hornet @ 2023-02-11 12:26:01
看一下我这个,评测了,100分AC。
#include<bits/stdc++.h>
using namespace std;int x[5]={0,-1,0,1,0},y[5]={0,0,1,0,-1},r,c,i,j,p,t,n=0,m[101][101],f[101][101];int se(int,int);
int main(){
cin>>r>>c;
for(i=1;i<=r;i++)
for(j=1;j<=c;j++)
cin>>m[i][j];
for(i=1;i<=r;i++)
for(j=1;j<=c;j++){
t=se(i,j);f[i][j]=t;
if(t>n)n=t;
}
cout<<n;
}
int se(int l,int k){
int i,t=1,e,b,d;
if(f[l][k]>0)return(f[l][k]);
for(i=1;i<=4;i++){
b=l+x[i];d=k+y[i];
if((b>0)&&(b<=r)&&(d>0)&&(d<=c)&&(m[l][k]<m[b][d])){
e=se(b,d)+1;
if(e>t)t=e;
}
}
f[l][k]=t;
return t;
}
by mysterys @ 2023-02-11 17:48:03
@Dark1Bunting8