Pagini recente » Cod sursa (job #2310666) | Cod sursa (job #1376703) | Cod sursa (job #3180636) | Cod sursa (job #3294112) | Cod sursa (job #58415)
Cod sursa(job #58415)
program cutii;
const
fin='cutii.in';
fout='cutii.out';
nmax=3500;
type
box=record
x,y,z:longint;
end;
var
a:array[1..nmax] of box;
nr:array[0..nmax] of longint;
i,j,k,n,it,t,x,y,z,max,best:longint;
begin
assign(input,fin);
assign(output,fout);
reset(input);
rewrite(output);
readln(n,t);
for it:=1 to t do
begin
best:=0;
for i:=1 to n do
readln(a[i].x,a[i].y,a[i].z);
for i:=1 to n do
begin
max:=0;
for j:=1 to n do
if ((a[i].x<a[j].x)and(a[i].y<a[j].y))and(a[i].z<a[j].z) then
if nr[j]>max then
max:=nr[j];
nr[i]:=max+1;
if nr[i]>best then
best:=nr[i];
end;
writeln(best);
end;
close(input);
close(output);
end.