Cod sursa(job #195084)

Utilizator nod_softwareBudisteanu Ionut Alexandru nod_software Data 16 iunie 2008 17:15:33
Problema Cutii Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 2.12 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:integer;
    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;

                for i:=1 to n do
                        if v[i].ok then
                        begin
                                max:=-maxint; o:=0;
                                for j:=1 to n do
                                begin
                                        if (v[j].ok) and (i<>j) then
                                        begin
                                                s:=v[j].x+v[j].y+v[j].z;
                                                if (v[i].x>v[j].x) and (v[i].y>v[j].y) and (v[i].z>v[j].z) and (max < s) then
                                                begin
                                                        max:=s;
                                                        o:=j;
                                                end;
                                        end;
                                end;
                                if o > 0 then
                                begin
                                        v[i].ok:=false;
                                        v[i].k:=false ;
                                        v[o].k:=false;
                                        //v[o].ok:=false;
                                   //     c:=c+1;
                                end;
                        end;
                   for i:=1 to n do if not v[i].k then inc(c); 
                   writeln(fout,c);

        end;


        close(fin);
        close(fout);
end.