Pagini recente » Cod sursa (job #1530992) | Cod sursa (job #1628206) | Cod sursa (job #2409110) | Cod sursa (job #2295839) | Cod sursa (job #29029)
Cod sursa(job #29029)
var f,g:text;
t,n:integer;
a:array[0..3500,1..3]of integer;
b,v:array[0..3500]of integer;
procedure rez;
var i,j,p,max:integer;
begin
for i:=1 to n do begin
readln(f,a[i,1],a[i,2],a[i,3]);
v[i]:=a[i,1]*100+a[i,2]*10+a[i,3];
end;
max:=1;
for i:=1 to n do begin
b[i]:=0;
for j:=i+1 to n do
if v[i]>v[j] then begin
a[0]:=a[i];
a[i]:=a[j];
a[j]:=a[0];
end;
end;
for i:=1 to n do begin
j:=0;
p:=0;
b[i]:=1;
while j<i-1 do begin
j:=j+1;
if b[i]<=b[j] then
if a[i,1]>a[j,1] then
if a[i,2]>a[j,2] then
if a[i,3]>a[j,3] then begin
p:=j;
b[i]:=b[j]+1;
end;
end;
if max<b[i] then max:=b[i];
end;
writeln(g,max);
end;
begin
assign(f,'cutii.in');
assign(g,'cutii.out');
rewrite(g);
reset(f);
readln(f,n,t);
for t:=1 to t do rez;
close(g);
end.