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 I got WAЈїЈїЈїЈїЈїЈїЈї
Posted by qwt 25 Apr 2002 18:49
var
  a:array[0..14000] of longint;
  b:array[-1..200000] of longint;
  n,i,j,k,max:longint;

begin
  read(n);
  fillchar(a,sizeof(a),0);fillchar(b,sizeof(b),0);    b[-
1]:=10000;max:=-1;
  for i:=0 to n-2 do begin
    read(a[i]);
    if a[i]=-1 then begin writeln(max);halt;end;
    inc(b[a[i]]);
    if a[i]>max then max:=a[i];
  end;
  read(j);
  while j>=0 do begin
    inc(i);
    i:=i mod n;
    dec(b[a[i]]);a[i]:=j;
    inc(b[j]);
    if j>max then max:=j;
    while b[max]<=0 do dec(max);
    writeln(max);
    read(j);
  end;
end.
Re: Why I got WA&#1032;&#1111;&#1032;&#1111;&#1032;&#1111;&#1032;&#1111;&#1032;&#1111;&#1032;&#1111;&#1032;&#1111;
Posted by SOM (Sokolov Maxim_NN_Liceum165) 17 Oct 2010 00:31
Because first chislo is m (don't n)

Edited by author 17.10.2010 00:31

Edited by author 17.10.2010 00:31