Cod sursa(job #58415)

Utilizator gurneySachelarie Bogdan gurney Data 5 mai 2007 20:17:35
Problema Cutii Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.88 kb
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.