Pagini recente » Cod sursa (job #507939) | Cod sursa (job #3246584) | Cod sursa (job #13372) | Cod sursa (job #35670) | Cod sursa (job #35928)
Cod sursa(job #35928)
var f,g:text;
n,t,i,j,a:integer;
y,z,s:array[1..3500]of integer;
procedure rez;
begin
for i:=1 to n do begin
read(f,a);
read(f,y[a],z[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.