Cod sursa(job #64584)

Utilizator raduzerRadu Zernoveanu raduzer Data 4 iunie 2007 14:07:29
Problema Secventa Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.72 kb
var a:array[1..500000]of integer;
    max,min,x:integer;
    n,i,j,k,p,u:longint;
begin
     assign(input,'secventa.in');
     reset(input);
     assign(output,'secventa.out');
     rewrite(output);
     readln(n,k);
     max:=-31000;
     for i:=1 to n do
     begin
          read(a[i]);
          min:=k;
          x:=31000;
          if i<min then min:=i;
          for j:=i-min+1 to i do
          begin
               if a[j]<x then
               begin
                    x:=a[j];
               end;
          end;
          if x>max then
          begin
               max:=x;
               p:=i-min+1;
               u:=i;
          end;
     end;
     writeln(p,' ',u,' ',max);
close(output);
end.