Pagini recente » Cod sursa (job #2976960) | Cod sursa (job #1906263) | Cod sursa (job #180615) | Cod sursa (job #156778) | Cod sursa (job #39326)
Cod sursa(job #39326)
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:=0;min:=0;
x:=0;
y:=0;
i:=0;
while i<n do
begin
inc(I);
min:=maxint;
for j:=i to i+k-1 do
if a[j]<min then begin
min:=a[j];
poz:=i;
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.