Dawn_Chase @ 2018-01-10 19:58:45
RT,自己的IDE上跑的答案正确,提交上去WA了???
by Dawn_Chase @ 2018-01-10 19:59:14
const e:array[1..4,1..2] of -1..1=((0,-1),(-1,0),(1,0),(0,1));
var n,m,i,j,t,ans:longint;
f,h:array[0..101,0..101] of longint;
function max(x,y:longint):longint;
begin
if x>y then
exit(x);
exit(y);
end;
function ss(x,y:longint):longint;
var k,xx,yy:longint;
begin
if f[x,y]>0 then
exit(f[x,y]);
t:=1;
for k:=1 to 4 do
begin
xx:=x+e[k,1];yy:=y+e[k,2];
if (xx>0) and (xx<=n) and (yy>0) and (yy<=n) and (h[xx,yy]<h[x,y]) then
t:=max(ss(xx,yy)+1,t);
end;
f[x,y]:=t;
exit(f[x,y]);
end;
begin
read(n,m);
for i:=1 to n do
for j:=1 to m do
read(h[i,j]);
for i:=1 to n do
for j:=1 to m do
begin
t:=ss(i,j);
if t>ans then
ans:=t;
end;
writeln(ans);
end.
by Dawn_Chase @ 2018-01-10 20:00:29
求大佬解释:
数据输入:
10 5 56 14 51 58 88
26 94 24 39 41
24 16 8 51 51
76 72 77 43 10
38 50 59 84 81
5 23 37 71 77
96 10 93 53 82
94 15 96 69 9
74 0 62 38 96
37 54 55 82 38
数据输出:
7
by Dawn_Chase @ 2018-01-10 20:06:17
自己的IDE
luogu的在线IDE跑的是5??
by Dawn_Chase @ 2018-01-10 20:31:19
@yjjr
@zhouyonglong
by FlierKing @ 2018-01-12 17:54:15
@slzxzxh 请在洛谷在线IDE进行测试
by 2017gangbazi @ 2018-01-28 18:14:33
我这个在本地跑都是5/笑哭
by Dawn_Chase @ 2018-02-23 21:56:43
蒟蒻改c++后,编译器告诉我6>5是错的[滑稽] 求大佬指教
by Dawn_Chase @ 2018-02-23 22:33:09
于是在过程里又var了一遍t就过了。。。
by 帅比王2018 @ 2018-06-08 16:49:50
正确答案是7还是5啊?