笙瑟 @ 2017-12-15 15:07:42
const
dx:array[1..4] of longint=(0,0,1,-1);
dy:array[1..4] of longint=(-1,1,0,0);
var
n,m,i,j,ans,t:longint;
a,dist:array[1..100,1..100] of longint;
function dfs(x,y:longint):longint;
var
i,max,ans,x1,y1:longint;
begin
max:=1;
if dist[i,j]>0 then exit(dist[i,j]);
for i:=1 to 4 do
begin
x1:=x+dx[i];y1:=y+dy[i];
if (x1>=1)and(x1<=n)and(y1>=1)and(y1<=m)and(a[x1,y1]<a[x,y]) then
begin
ans:=dfs(x1,y1)+1;
if max<ans then max:=ans;
end;
end;
dist[x,y]:=max;
exit(max);
end;
begin
read(n,m);
for i:=1 to n do
for j:=1 to m do
read(a[i,j]);
for i:=1 to n do
for j:=1 to m do
begin
t:=dfs(i,j);
dist[i,j]:=t;
if ans<t then ans:=t;
end;
write(ans);
end.
by BFSBFSBFSBFS @ 2017-12-15 15:29:44
大概越界了..
by AutumnKite @ 2017-12-15 16:14:51
尹凯乐... @BFSBFSBFSBFS
by BFSBFSBFSBFS @ 2017-12-16 07:48:23
@rill7747 ..抓我干嘛..
by AutumnKite @ 2017-12-16 08:56:24
.....