Pagini recente » Cod sursa (job #2472146) | Cod sursa (job #2554109) | Cod sursa (job #655438) | Cod sursa (job #2542696) | Cod sursa (job #550737)
Cod sursa(job #550737)
var i,j,n,m,x,y,min:longint;
f1,f2:text;
a:array[1..100000]of longint;
begin
assign(f1,'rmq.in');
reset(f1);
assign(f2,'rmq.out');
rewrite(f2);
readln(f1,n,m);
for i:=1 to n do
readln(f1,a[i]);
for i:=1 to m do
begin
readln(f1,x,y);
min:=a[x];
for j:=x+1 to y do
if a[j]<min then min:=a[j];
writeln(f2,min);
end;
close(f1);
close(f2);
end.