Pagini recente » Rating Cotoc Alexandru (CotocAlexandru) | Cod sursa (job #1121142) | Cod sursa (job #62540) | Cod sursa (job #2760355) | Cod sursa (job #35919)
Cod sursa(job #35919)
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;
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 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.