type my=record
来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/11/20 03:48:51
type my=record
val,l,r:longint;
end;
var n,i,root,a,ppool:longint;
da:array[0..100010]of my;
procedure print(v:longint);
begin
if v=0 then exit;
print(da[v].l);
write(da[v].val,' ');
print(da[v].r);
end;
procedure ins(var v:longint;a:longint);
begin
if v=0 then
begin
inc(ppool);
v:=ppool;
da[v].val:=a;
end;
if a
val,l,r:longint;
end;
var n,i,root,a,ppool:longint;
da:array[0..100010]of my;
procedure print(v:longint);
begin
if v=0 then exit;
print(da[v].l);
write(da[v].val,' ');
print(da[v].r);
end;
procedure ins(var v:longint;a:longint);
begin
if v=0 then
begin
inc(ppool);
v:=ppool;
da[v].val:=a;
end;
if a
请等一下 我在看你的程序.
我也搞过OI
能补充一下问题是什么吗.
我的机子上没有FP
要帮您调试的话稍等下
经过我简单的调试
发现ins过程中少了一的exit导致201暴栈
如果没有其他错误因该是
在da[v].val:=a;后加一个exit;
我本人写c++的 pascal可能写不好.
正确程序:
type my=record
val,l,r:longint;
end;
var n,i,root,a,ppool:longint;
da:array[0..100010]of my;
procedure print(v:longint);
begin
if v=0 then exit;
print(da[v].l);
write(da[v].val,' ');
print(da[v].r);
end;
procedure ins(var v:longint;a:longint);
begin
if v=0 then
begin
inc(ppool);
v:=ppool;
da[v].val:=a;
exit;
end;
if ab then exit(b) else exit(a);
end;
function max(a,b:longint):longint;
begin
if a>b then exit(a) else exit(b);
end;
constructor Ttreap.init;
begin
randomize;
total:=1;
with t[total] do
begin
total:=1;
key:=-1;
value:=-1;
fa:=0;
end;
root:=1;
end;
procedure Ttreap.turn(father,son:longint);
begin
t[son].fa:=t[father].fa;
if t[t[father].fa].right=father then t[t[father].fa].right:=son
else t[t[father].fa].left:=son;
t[father].fa:=son;
if t[father].right=son then
begin
t[t[son].left].fa:=father;
t[father].right:=t[son].left;
t[son].left:=father;
end
else
begin
t[t[son].right].fa:=father;
t[father].left:=t[son].right;
t[son].right:=father;
end;
t[son].total:=t[father].total;
t[father].total:=t[t[father].left].total+t[t[father].right].total+1;
end;
procedure Ttreap.insert(x:longint);
var
i,last:longint;
begin
i:=root;
while i0 do
begin
last:=i;
inc(t[i].total);
if x>t[i].value then i:=t[i].right
else i:=t[i].left;
end;
inc(total);
with t[total] do
begin
total:=1;
key:=random(range);
value:=x;
left:=0;
right:=0;
fa:=last;
end;
if x>t[last].value then t[last].right:=total else t[last].left:=total;
while t[total].keyt[i].value then i:=t[i].right
else
begin
h:=i;
i:=t[i].left;
end;
end;
t[h].value:=t[last].value;
t[h].key:=t[last].key;
if t[last].left=0 then k:=t[last].right else k:=t[last].left;
j:=t[last].fa;
t[k].fa:=j;
if t[j].left=last then t[j].left:=k else t[j].right:=k;
end;
function Ttreap.find(x:longint):longint;
var
i:longint;
begin
i:=t[root].right;
while x>0 do
begin
if t[t[i].left].total+1=x then exit(t[i].value);
if t[t[i].left].total>=x then i:=t[i].left
else
begin
x:=x-t[t[i].left].total-1;
i:=t[i].right;
end;
end;
end;
procedure qsort(left,right:longint);
var
i,j,x,xx:longint;
begin
i:=left;
j:=right;
x:=a[(i+j) shr 1];
xx:=b[(i+j) shr 1];
while i
我也搞过OI
能补充一下问题是什么吗.
我的机子上没有FP
要帮您调试的话稍等下
经过我简单的调试
发现ins过程中少了一的exit导致201暴栈
如果没有其他错误因该是
在da[v].val:=a;后加一个exit;
我本人写c++的 pascal可能写不好.
正确程序:
type my=record
val,l,r:longint;
end;
var n,i,root,a,ppool:longint;
da:array[0..100010]of my;
procedure print(v:longint);
begin
if v=0 then exit;
print(da[v].l);
write(da[v].val,' ');
print(da[v].r);
end;
procedure ins(var v:longint;a:longint);
begin
if v=0 then
begin
inc(ppool);
v:=ppool;
da[v].val:=a;
exit;
end;
if ab then exit(b) else exit(a);
end;
function max(a,b:longint):longint;
begin
if a>b then exit(a) else exit(b);
end;
constructor Ttreap.init;
begin
randomize;
total:=1;
with t[total] do
begin
total:=1;
key:=-1;
value:=-1;
fa:=0;
end;
root:=1;
end;
procedure Ttreap.turn(father,son:longint);
begin
t[son].fa:=t[father].fa;
if t[t[father].fa].right=father then t[t[father].fa].right:=son
else t[t[father].fa].left:=son;
t[father].fa:=son;
if t[father].right=son then
begin
t[t[son].left].fa:=father;
t[father].right:=t[son].left;
t[son].left:=father;
end
else
begin
t[t[son].right].fa:=father;
t[father].left:=t[son].right;
t[son].right:=father;
end;
t[son].total:=t[father].total;
t[father].total:=t[t[father].left].total+t[t[father].right].total+1;
end;
procedure Ttreap.insert(x:longint);
var
i,last:longint;
begin
i:=root;
while i0 do
begin
last:=i;
inc(t[i].total);
if x>t[i].value then i:=t[i].right
else i:=t[i].left;
end;
inc(total);
with t[total] do
begin
total:=1;
key:=random(range);
value:=x;
left:=0;
right:=0;
fa:=last;
end;
if x>t[last].value then t[last].right:=total else t[last].left:=total;
while t[total].keyt[i].value then i:=t[i].right
else
begin
h:=i;
i:=t[i].left;
end;
end;
t[h].value:=t[last].value;
t[h].key:=t[last].key;
if t[last].left=0 then k:=t[last].right else k:=t[last].left;
j:=t[last].fa;
t[k].fa:=j;
if t[j].left=last then t[j].left:=k else t[j].right:=k;
end;
function Ttreap.find(x:longint):longint;
var
i:longint;
begin
i:=t[root].right;
while x>0 do
begin
if t[t[i].left].total+1=x then exit(t[i].value);
if t[t[i].left].total>=x then i:=t[i].left
else
begin
x:=x-t[t[i].left].total-1;
i:=t[i].right;
end;
end;
end;
procedure qsort(left,right:longint);
var
i,j,x,xx:longint;
begin
i:=left;
j:=right;
x:=a[(i+j) shr 1];
xx:=b[(i+j) shr 1];
while i
Warranty Type:Contact seller of record的翻译是:
record
my computer cannot type chinese
英语翻译The comment record type is used to comment on the follow
英语翻译------=_NextPart_4B30FA76_0941D758_3D53CFB9Content-Type:
My sister gave me a record.The record is very interesting 怎样
Can you type english answer my question?
请问it is my type是意思
翻译下T.I.的My Type
翻译oops!i screwed my record producer again
Future is dependent upon my record of success.
&type=0什么意思?