Pagini recente » Cod sursa (job #2663887) | Cod sursa (job #238732) | Cod sursa (job #768846) | Cod sursa (job #2121641) | Cod sursa (job #31251)
Cod sursa(job #31251)
var v:array[1..500001]of longint;
i,j,max,min,n,k,s,d:longint;
begin
assign(input,'secventa.in');reset(input);
assign(output,'secventa.out');rewrite(output);
readln(n,k);
for i:=1 to n do read(v[i]);
for i:=1 to n-1 do begin
min:=v[i];
for j:=i+1 to n do begin
if v[j]<min then min:=v[j];
if (j-i+1)>=k then
if min>max then begin max:=min;s:=i;d:=j;end;
end;
end;
writeln(s,' ',d,' ',max);
close(input);close(output);
end.