Pagini recente » Cod sursa (job #1394618) | Cod sursa (job #20513) | Cod sursa (job #1787602) | Cod sursa (job #1393226) | Cod sursa (job #7379)
Cod sursa(job #7379)
program secventa1;
type vector = array [1..500000] of integer;
var v:vector;
i,j,k,x,y,n:integer;
min,max:longint;
fin,fout:text;
begin
assign(fin,'secventa.in');
assign(fout,'secventa.out');
reset(fin);
rewrite(fout);
readln(fin,n,k);
for i:=1 to n do
read(fin,v[i]);
max:=0;
for i:=1 to n-1 do
begin
j:=i-1;
min:=v[j+1];
while (j<n) do
begin
inc(j);
end;
if (max < min) and (j-i+1>=k) then
begin
max:=min;
x:=i;
y:=j;
end;
end;
writeln(fout,x,' ',y,' ',max);
close(fout);
end.