- 迎春舞会之交谊舞
- 2009-06-03 14:15:57 @
var
a:array[1..1000000] of int64;
b:array[1..1000000] of int64;
i,n,m,k,j,p,t,d:longint;
begin
readln(n);
read(m);
for i:= 1 to m do
a[m]:=0;
a[m+1]:=1;
b[1]:=m;
k:=2;
t:=1;
p:=m+2;
repeat
inc(k);
inc(t);
read(b[t]);
if b[t]>b[t-1] then
begin
a[p]:=0;
a[p+1]:=1;
inc(p,2);
end;
if b[t]=b[t-1] then
begin
a[p]:=1; inc(p);
end;
until k=n+1;
for i:=m+1 to 2*n do
begin
d:=0;
if a[i]=1 then
begin
j:=i;
repeat
dec(j);
if a[j]1 then inc(d);
until a[j]=0;
a[j]:=3;
write(d,' ');
end;
end;
end.
样例过了!!!
1 条评论
-
张映田 LV 7 @ 2013-07-04 23:52:08
差不多,也过不了
- 1