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

Help! I am quite sure this should work but it gets WA. WHY?!!!
Posted by Alex[LSD] 6 Jun 2003 10:38
My Email : caa@baga.ac.net.ru
=-=-=-=-=
Program acm_1126;

Var A            : array [1..25000] of longint;
    G            : array [0..400,0..299] of longint;
    Nums         : array [0..400] of longint;
    i,j,k        : longint;
    M,N          : longint;

Begin
  FillChar(G,sizeOf(G),0); FillChar(Nums,sizeOf(Nums),0);

  Read(M);

  i:=0; N:=0;
  While i<>-1 do BegiN
    Read(i);
    If i<>-1 then Begin
      Inc(N); A[N]:=i;
    End;
  End;

  For i:=1 to N do Begin
    j:=A[i] div 300; k:=A[i] mod 300; Inc(G[j,k]); Inc(Nums[j]);

    If i>M then Begin
      j:=A[i-M] div 300; k:=A[i-M] mod 300; Dec(G[j,k]); Dec(Nums[j]);
    End;

    If i>=M then Begin
      k:=400; While Nums[k]=0 do Dec(k);
      j:=299; While G[k,j]=0 do Dec(j);
      writeln(300*k+j);
    End;
  End;
End.
Re: Help! I am quite sure this should work but it gets WA. WHY?!!!
Posted by Tony 6 Jun 2003 15:46
Read this program more clear again!
Oh believe me I ve read it tens of times. And I just cant figure out how it doesnt get AC... 8-( [HEEEEEELP!!!]
Posted by Alex[LSD] 10 Jun 2003 10:49