大牛们帮忙看看怎么错了

const maxn=1 shl 20;

var i,j,n,m,k,price,pp:longint;

t,c,a:array[-1000..10000000] of longint;

function lowbit(x:longint):longint;

begin

lowbit:=((x-1) xor x) and x;

end;

procedure add(x,d:longint);

begin

while x=maxn)or(cnt+c[ans]>=k) then ans:=ans-(1shl j)

else cnt:=cnt+c[ans];

end;

exit(ans+1);

end;

begin

fillchar(a,sizeof(a),true);

readln(price);

i:=0;

repeat

read(pp);

if pp=0 then exit;

readln(n);

case pp of

1:begin inc(i);

t[i]:=n;

add(i,n);

inc(a[n]);end;

2:dec(a[t[n]]);

3:begin

k:=find(n);

if k>price then writeln('Dui bu qi,Mei you.')

else begin

if a[k]

0 条评论

目前还没有评论...

信息

ID
1647
难度
9
分类
数据结构 | 平衡树数据结构 | 线段树 点击显示
标签
(无)
递交数
1923
已通过
137
通过率
7%
被复制
3
上传者