const vc=1000000000;
var a,f,t,ds,b:array[0..100000] of longint;
n,i,max,res,k:longint;
procedure nhap;
var i:longint;
begin
read(n);
for i:=1 to n do read(a[i]);
end;
procedure truyvet(k:Longint);
var i,d:longint;
ds:array[1..1000000] of longint;
begin
d:=0;
while k>0 do
begin
inc(d);
ds[d]:=k;
k:=t[k];
end;
for i:=d downto 1 do write(ds[i],' ');
end;
function bs(x,l,r:longint):longint;
var res,m:longint;
begin
res:=0;
while l<=r do
begin
m:=(l+r) div 2;
if (a[b[m]]<a[x]) then
begin
res:=m;
l:=m+1;
end
else r:=m-1;
end;
exit(res);
end;
procedure xuli;
var i,j,jmax,z,d:longint;
begin
f[1]:=1;res:=1; b[1]:=1;
for i:=2 to n do
begin
k:=bs(i,1,f[res]);
f[i]:=k+1;
t[i]:=b[k];
if f[res]<f[i] then res:=i;//max:=0;
b[f[i]]:=i;
end;
writeln(f[res]);d:=0;
truyvet(res);
end;
begin
assign(input,'liqlis.inp');reset(input);
assign(output,'liqlis.out');rewrite(output);
nhap;
xuli;
end.
* Chuyên dạy lập trình ONLINE cho học sinh THCS, THPT *.
Mọi giao lưu, trao đổi, xin liên hệ: Lê Quang Vinh - zalo: 037.803.8755.
Page: Lớp học Code Sky
Group FB1: Ôn thi HSG9 - THTB - TS10 chuyên tin
Group FB2: Học Scratch - Ôn thi Tin học trẻ bảng A
Thứ Ba, 3 tháng 5, 2022
LIQLIS sub 3 pascal
Đăng ký:
Đăng Nhận xét (Atom)
Không có nhận xét nào:
Đăng nhận xét
Lưu ý: Chỉ thành viên của blog này mới được đăng nhận xét.