ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1126. Magnetic Storms

Why WA?
Posted by Alex[LSD] 22 Mar 2002 22:49
I know I'd probably get Time Limit. But can anyone explain why I m
getting WA in this source... Please email : swin@mail2000.ru
=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=
Program acm_1126;
const maxx=25000;
Var A,B         :array [1..maxx] of longint;
    M,N         :Integer;
    i,j,k       :Longint;
Begin
  Readln(M);
  i:=0; k:=0;
  While i<>-1 do
  Begin
    Read(i);
    If i<>-1 Then Begin Inc(k); A[k]:=i; End;
  End;

  N:=k;

  For i:=1 to N do
  B[i]:=A[i];

  For i:=1 to N do
  Begin
    k:=i+1;
    While (A[i]>A[k])and(k-i<M)and(k<=n) do
    Begin
      If A[i]>B[k] then B[k]:=A[i];
      Inc(k);
    End;
  End;
  For i:=M to N do
  Writeln(B[i]);
End.