Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:这道题太弱了,我们学校的人把这题数据改成了2000In Reply To:Re:这道题太弱了,我们学校的人把这题数据改成了2000 Posted by:lifeich1 at 2010-02-01 20:17:33 const d:array[1..4,1..2] of longint=((0,1),(0,-1),(1,0),(-1,0)); var n,m,i,j,ans:longint; a,f:array[0..101,0..101] of longint; procedure dp(x,y:longint); var i,max,x1,y1:longint; begin if f[x,y]>-1 then exit; max:=1; for i:=1 to 4 do begin x1:=x+d[i,1]; y1:=y+d[i,2]; if (x1>n)or(x1<1)or(y1>m)or(y1<1) then continue; if a[x1,y1]>=a[x,y] then continue; dp(x1,y1); if max<f[x1,y1]+1 then max:=f[x1,y1]+1; end; f[x,y]:=max; end; begin readln(n,m); for i:=1 to n do for j:=1 to m do read(a[i,j]); fillchar(f,sizeof(f),255); for i:=1 to n do for j:=1 to m do if f[i,j]=-1 then dp(i,j); ans:=-1; for i:=1 to n do for j:=1 to m do if f[i,j]>ans then ans:=f[i,j]; writeln(ans); end. 程序很简单 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator