Cod sursa(job #7379)

Utilizator nod_softwareBudisteanu Ionut Alexandru nod_software Data 21 ianuarie 2007 13:55:37
Problema Secventa Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.64 kb
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.