Cod sursa(job #195150)

Utilizator nod_softwareBudisteanu Ionut Alexandru nod_software Data 16 iunie 2008 21:10:27
Problema Cutii Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 2.63 kb
program cutii;
{$APPTYPE CONSOLE}  
uses  
  SysUtils;   
type cutie = record  
        x,y,z:integer;   
        ok,k:boolean;   
end;   
var j,max,o,q,s,t,c,i,n,m,b,aux:integer;
   x, v:array [1..3500] of cutie;
    fin,fout:text;
{*---------------------------------------*}  
begin  
        assign(fin,'cutii.in'); reset(fin);   
        assign(fout,'cutii.out'); rewrite(fout);   
        readln(fin,n,t);
        for q:=1 to t do  
        begin  
                c:=0;   
                For i:=1 to n do  
                begin  
                        readln(fin,v[i].x,v[i].y,v[i].z);   
                        v[i].ok:=true;   
                        v[i].k:=true;   
                end;  ;// o:=1;
                 
                 for i:=1 to n do begin
                  max:=i;
                 for j:=i to n do begin
                                  
                                   if v[j].x<v[max].x then    begin
                                                        max :=j;
                                                        end ;
                                 end;
                                 aux:=v[i].x;
                                 v[i].x:=v[max].x;
                                 v[max].x:=aux;

                                  aux:=v[i].y;
                                 v[i].y:=v[max].y;
                                 v[max].y:=aux;

                                   aux:=v[i].z;
                                 v[i].  z:=v[max].z;
                                 v[max].z:=aux;


                                 end;
                               max:=1;
                for i:=n downto  1 do

                        begin
                                 o:=i;
                                  c:=1;
                                  j:=n;

                                while j >0 do
                                begin
                                               dec (j);

                                                if (v[o].x>v[j].x) and (v[o].y>v[j].y) and (v[o].z>v[j].z)  then
                                                begin

                                                        o:=j;
                                                        c:=c+1;
                                                       // j:=0;
                                                end;

                                end;

                                if c>max then max:=c;
                        end;

                   writeln(fout,max);
  
        end;   
  
  
        close(fin);   
        close(fout);   
end.