- 小白逛公园
- 2013-02-23 09:12:57 @
6 条评论
-
twd2 LV 9 MOD @ 2013-02-23 23:32:18
runtime error==运行错误
-
2013-02-23 23:06:10@
运行错误吧
200 201 202啥的 -
2013-02-23 23:04:00@
runtime error是运行时错误的英文表达。
-
2013-02-23 14:30:20@
数据越界啥的
-
2013-02-23 09:17:42@
表示这个程序在rqnoj上运行错误;在vijos上rantime error
-
2013-02-23 09:15:07@
program spg;
type
point=^tree;
tree=record
n,m:point;
l,r,c:longint;
end;
var
t:point;
i,j,k,l,x,y,a:longint;
procedure maketree(var t:point);
begin
t^.c:=0;
if t^.l<t^.r then begin
l:=(t^.l+t^.r) div 2;
new(t^.n);new(t^.m);
t^.n^.l:=t^.l;t^.n^.r:=l;
t^.m^.l:=l+1;t^.n^.r:=t^.r;
maketree(t^.n);maketree(t^.m);
end;
end;
procedure jia(var t:point;i,k:longint);
var
m:longint;
begin
if t^.l<t^.r then begin
m:=(t^.l+t^.r) div 2;
if m<i then jia(t^.m,i,k)
else jia(t^.n,i,k);
end else
t^.c:=k;
end;
procedure bc(var t:point);
begin
if t^.l+1<t^.r then begin
bc(t^.n);bc(t^.m);
end else
if t^.n^.c<t^.m^.c then t^.c:=t^.m^.c
else t^.c:=t^.n^.c;
end;
procedure print(t:point;l,r:longint);
var
m:longint;
begin
if (t^.l=l) and (t^.r=r) then
if t^.c>a then a:=t^.c
else
else begin
m:=(t^.l+t^.r) div 2;
if (r<=m) then print(t^.n,l,r);
if (l>m) then print(t^.m,l,r);
if (l<=m) and (r>m) then begin
print(t^.n,l,m);
print(t^.m,m+1,r);
end;
end;
end;
procedure gai(var t:point;l,k:longint);
var
m:longint;
begin
if t^.l<t^.r then begin
if l<=m then gai(t^.n,l,k);
if l>m then gai(t^.m,l,k);
if t^.n^.c<t^.m^.c then t^.c:=t^.m^.c
else t^.c:=t^.n^.c;
end else t^.c:=k;
end;
begin
readln(x,y);
new(t);
t^.l:=1;t^.r:=x;
maketree(t);
for i:=1 to x do begin
readln(k);
jia(t,i,k);
end;
bc(t);
for i:=1 to y do begin
readln(j,k,l);
if j=1 then begin
print(t,k,l);
writeln(a);
a:=0;
end;
if j=2 then gai(t,k,l);
end;
end.
- 1