Pagini recente » Cod sursa (job #2804769) | Cod sursa (job #2704956) | Cod sursa (job #896340) | Istoria paginii utilizator/realmeabefir | Cod sursa (job #39344)
Cod sursa(job #39344)
var f,g:text;
a:array[0..500000] of longint;
mini,n,i,j,k,l,max,min,poz,pozi,x,y:longint;
begin
assign(f,'secventa.in');
assign(g,'secventa.out');
reset(F);
rewrite(G);
readln(f,n,k);
for i:=1 to n do
read(f,a[i]);
poz:=-1;
max:=-maxlongint;min:=0;
x:=0;
y:=0;
i:=0;
while i<n do
begin
inc(I);
min:=maxlongint;
for j:=i to i+k-1 do
if a[j]<min then begin
min:=a[j];
poz:=j;
end;
if min>max then begin
max:=min;
x:=i;
y:=i+k-1;
end;
if poz>i then i:=poz;
end;
writeln(g,x,' ',y,' ',max);
close(F);
close(G);
end.