HNOI2004打鼹鼠(LIS)
大水题……
不过通过这题我们应该养成一个好习惯:好好看清题……
竟然没有看到时限 10sec……
1 var i,j,n,m,ans:longint; 2 f,time,x,y:array[0..15000] of longint; 3 function max(x,y:longint):longint; 4 begin 5 if x>y then exit(x) else exit(y); 6 end; 7 procedure main; 8 begin 9 readln(n,m);ans:=0; 10 for i:=1 to m do 11 begin 12 f[i]:=1; 13 readln(time[i],x[i],y[i]); 14 for j:=i-1 downto 1 do 15 if time[i]-time[j]>=abs(x[i]-x[j])+abs(y[i]-y[j]) 16 then f[i]:=max(f[i],f[j]+1); 17 ans:=max(ans,f[i]); 18 end; 19 writeln(ans); 20 end; 21 begin 22 main; 23 end.