Cod sursa(job #167550)

Utilizator noi_marinescuotilia marinescu noi_marinescu Data 29 martie 2008 18:45:58
Problema Cutii Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.78 kb
type cutie=record
x,y,z:1..3500;
end;

var    f,g:text; t:1..100;i,j,k:1..3500;n:1..3500;aux:cutie;a:array[1..3500] of cutie; l:array[1..3500] of integer; ok:boolean;
max:integer;
begin
assign(f,'cutii.in');
assign(g,'cutii.out');
reset(f); rewrite(g);
readln(f,n,t);
for i:=1 to t do begin

for j:=1 to n do readln(f, a[j].x, a[j].y, a[j].z);

{repeat
ok:=true;
for k:=1 to n-1 do
if a[k].x>a[k+1].x then begin
aux:=a[k];
a[k]:=a[k+1];
a[k+1]:=aux;
ok:=false;
end;
until ok=true;}
l[n]:=1;
for k:=n-1 downto 1 do
begin
l[k]:=1;
for j:=1+k to n do
if (a[k].x< a[j].x) and (a[k].y<a[j].y) and (a[k].z<a[j].z) and (l[k]<1+l[j]) then

l[k]:=1+l[j];
end;
max:=l[1];
for k:=2 to n do
if max<l[k] then max:=l[k];
writeln(g, max);    end;
close(f);
close(g);
end.