Pagini recente » Cod sursa (job #1141447) | Cod sursa (job #2150338) | Cod sursa (job #2534596) | Cod sursa (job #1080492) | Cod sursa (job #844561)
Cod sursa(job #844561)
program arbori_de_intervale;
var f1,f2:text;
n,m,i,j,b,c,max:longint;
a:array [1..100000] of longint;
op:byte;
bufin,bufout:array [1..100000] of byte;
begin
assign(f1,'arbint.in');
reset(f1);
assign(f2,'arbint.out');
rewrite(f2);
settextbuf(f1,bufin);
settextbuf(f2,bufout);
readln(f1,n,m);
for i:=1 to n do read(f1,a[i]); readln(f1);
for i:=1 to m do
begin
readln(f1,op,b,c);
if op=0 then
begin
max:=a[b];
for j:= b+1 to c do
if a[j]>max then max:=a[j];
writeln(f2,max);
end
else a[b]:=c;
end;
close(f1);
close(f2);
end.