永hhyhhyhhy乐 @ 2020-04-13 12:28:46
var
n,m,i,j,sum,max,maxx:longint;
a,f:array[0..99,0..100] of longint;
b:array[1..4] of longint=(-1,0,1,0);
c:array[1..4] of longint=(0,-1,0,1);
function pk(x,y:longint):longint;
var i:longint;
begin
if f[x,y]=0 then exit;
for i:=1 to 4 do
if (a[x+b[i],y+c[i]]<a[x,y])and(f[x+b[i],y+c[i]]=-1) then
begin
inc(sum);
f[x+b[i],y+c[i]]:=1;
if sum>max then max:=sum;
pk(x+b[i],y+c[i]);
f[x+b[i],y+c[i]]:=-1;
dec(sum);
end;
end;
begin
readln(n,m);
fillchar(f,sizeof(f),0);
for i:=1 to n do
for j:=1 to m do begin read(a[i,j]);f[i,j]:=-1;end;
for i:=n downto 1 do
for j:=1 to m do
begin
sum:=1;max:=1;
pk(i,j);
if max>maxx then maxx:=max;
end;
writeln(maxx);
end.
。。。
by 永hhyhhyhhy乐 @ 2020-04-13 12:47:52
@BreakPlus 最后一个点被我用刷新卡过去了QAQ。。。
by impuk @ 2020-04-13 12:48:38
Pascal卡常?
by impuk @ 2020-04-13 12:48:46
来了
by BreakPlus @ 2020-04-13 12:49:13
@永houhaoyan 哦(顺便建议早点改行C++
by impuk @ 2020-04-13 12:50:45
诶?这题不是拓扑排序吗?
诶?这题不是dp吗?
by XeCtera @ 2020-04-13 12:51:57
@永houhaoyan 理论上这代码应该跑得飞快……
数组改成0..101,0..101吧,越界可能导致任何问题
by 永hhyhhyhhy乐 @ 2020-04-13 13:07:28
。。。我再改改
by 永hhyhhyhhy乐 @ 2020-04-13 13:07:51
应该是因为我的代码太差了