- 难解的问题
- 2009-07-28 11:20:35 @
var
a,s1,s2:array[0..1000000] of longint;
i,j,k,n,t,m,x,m1:longint;
begin
readln(n,k);
for i:=1 to n do read(a[i]);
m:=1;
s1[1]:=a[k];
s1[0]:=maxlongint;
for i:=k-1 downto 1 do begin
x:=a[i];
t:=m;
while x>=s1[t] do dec(t);
if t=m then begin
inc(m);
s1[m]:=a[i];
end else if t0 then s1[t+1]:=a[i];
end;
m1:=m;
m:=1;
s2[1]:=a[k];
s2[0]:=-5;
for i:=k+1 to n do begin
x:=a[i];
t:=m;
while x
0 条评论
目前还没有评论...