Pagini recente » Cod sursa (job #2015421) | Cod sursa (job #2627714) | Monitorul de evaluare | Cod sursa (job #331441) | Cod sursa (job #35913)
Cod sursa(job #35913)
var f,g:text;
n,t,i,j,a:integer;
x,y,z,s:array[1..3500]of integer;
procedure rez;
begin
for i:=1 to n do readln(f,x[i],y[i],z[i]);
for i:=1 to n do
for j:=i+1 to n do
if x[i]>x[j] then begin
a:=x[i];
x[i]:=x[j];
x[j]:=a;
a:=y[i];
y[i]:=y[j];
y[j]:=a;
a:=z[i];
z[i]:=z[j];
z[j]:=a;
end
else if x[i]=x[j] then if y[i]>y[j] then begin
a:=y[i];
y[i]:=y[j];
y[j]:=a;
a:=z[i];
z[i]:=z[j];
z[j]:=a;
end
else if y[i]=y[j] then if z[i]>z[j] then begin
a:=z[i];
z[i]:=z[j];
z[j]:=a;
end;
s[1]:=1;
a:=1;
for i:=2 to n do begin
s[i]:=1;
for j:=i-1 downto 1 do
if s[i]<s[j]+1 then
if x[i]>x[j] then
if y[i]>y[j] then
if z[i]>z[j] then s[i]:=s[j]+1;
if a<s[i] then a:=s[i];
end;
writeln(g,a);
end;
begin
assign(f,'cutii.in');
reset(f);
readln(f,n,t);
assign(g,'cutii.out');
rewrite(g);
for t:=1 to t do rez;
close(g);
end.