Pagini recente » Cod sursa (job #314414) | Cod sursa (job #2090538) | Cod sursa (job #697704) | Cod sursa (job #1739292) | Cod sursa (job #170726)
Cod sursa(job #170726)
type cutie=record
x,y,z:1..3500;
end;
tablou=array[1..3500] of cutie;
var f,g:text; t:1..100;i,j,k:1..3500;n:1..3500;aux:cutie;a:tablou; l:array[1..3500] of integer; ok:boolean;
max,min,s,d:integer;
x:cutie;
begin
assign(f,'cutii.in');
assign(g,'cutii.out');
reset(f); rewrite(g);
readln(f,n,t);
for i:=1 to t do begin
s:=n div 2;
d:=n-s;
x:=a[s];
repeat
i:=s;
j:=d;
repeat
while a[i].x<x.x do i:=i+1;
while a[j].x>x.x do j:=j-1;
if i<=j then begin
aux:=a[i]; a[i]:=a[j]; a[j]:=aux;
i:=i+1; j:=j-1
end;
until i>j;
until (s<j) and (i>d);
l[n]:=1;
for k:=n-1 downto 1 do
begin
l[k]:=1;
for j:=1+k to n do
if (a[k].x< a[j].x) and (a[k].y<a[j].y) and (a[k].z<a[j].z) and (l[k]<1+l[j]) then
l[k]:=1+l[j];
end;
max:=l[1];
for k:=2 to n do
if max<l[k] then max:=l[k];
writeln(g, max); end;
close(f);
close(g);
end.