clockwhite @ 2018-10-01 10:31:44
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
using namespace std;
int ___________,____________;
int ______[105][105],f[105][105],a[4]={0,1,0,-1},b[4]={-1,0,1,0},ans;
bool _______[105][105];
int _____________(int ____,int _){
if(f[____][_]!=1)return f[____][_];
else{
for(int ________=0;________<4;________++){
int __=____+a[________],___=_+b[________];
if(__>0&&__<=___________&&___>0&&___<=____________&&______[__][___]<______[____][_]){
if(f[__][___]!=0&&f[__][___]>f[____][_]&&_______[__][___]==0){
f[____][_]=f[__][___]+1;
_______[__][___]=1;
}
else f[____][_]=max(f[____][_],_____________(__,___)+1);
}
}
return f[____][_];
}
}
int main(){
scanf("%d%d",&___________,&____________);
for(int ________=1;________<=___________;________++){
for(int _________=1;_________<=____________;_________++){
scanf("%d",&______[________][_________]);
f[________][_________]=1;
}
}
for(int ________=1;________<=___________;________++){
for(int _________=1;_________<=____________;_________++){
memset(_______,0,sizeof(_______));
_______[________][_________]=1;
f[________][_________]=_____________(________,_________);
if(f[________][_________]>ans)ans=f[________][_________];
}
}
printf("%d",ans);
}
by Jaanai @ 2018-10-01 10:46:55
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#define OTZ using namespace std;int ___________,____________;int ______[105][105],f[105][105],a[4]={0,1,0,-1},b[4]={-1,0,1,0},ans;bool _______[105][105];int _____________(int ____,int _){ if(f[____][_]!=1)return f[____][_]; else{ for(int ________=0;________<4;________++){ int __=____+a[________],___=_+b[________]; if(__>0&&__<=___________&&___>0&&___<=____________&&______[__][___]<______[____][_]){ if(f[__][___]!=0&&f[__][___]>f[____][_]&&_______[__][___]==0){ f[____][_]=f[__][___]+1; _______[__][___]=1; } else f[____][_]=max(f[____][_],_____________(__,___)+1); } } return f[____][_]; }}int main(){ scanf("%d%d",&___________,&____________); for(int ________=1;________<=___________;________++){ for(int _________=1;_________<=____________;_________++){ scanf("%d",&______[________][_________]); f[________][_________]=1; } } for(int ________=1;________<=___________;________++){ for(int _________=1;_________<=____________;_________++){ memset(_______,0,sizeof(_______));_______[________][_________]=1; f[________][_________]=_____________(________,_________); if(f[________][_________]>ans)ans=f[________][_________]; } } printf("%d",ans);}
OTZ
by andyli @ 2018-10-01 10:47:04
%%%