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

can anyone give me some tests?
Posted by qwt 3 Apr 2002 20:00
var
  a:array[0..14000] of integer;
  b:array[0..25000] of integer;
  n,i,j,k,max:integer;

begin
  readln(n);
  fillchar(a,sizeof(a),0);fillchar(b,sizeof(b),0);    b[0]:=1;max:=0;
  for i:=0 to n-2 do begin
    readln(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;
  readln(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;
    k:=max;
    if b[max]=0 then for max:=k-1 downto 0 do if b[max]>0 then break;
    writeln(max);
    readln(j);
  end;
end.
Re: can anyone give me some tests?
Posted by Calin Ciutu (ciutu@go.ro) 4 Apr 2002 01:36
for 3: 108900
and for 4: 598950
Re: can anyone give me some tests?
Posted by Calin Ciutu (ciutu@go.ro) 4 Apr 2002 01:48
Excuse me !! This are some tests for 1206 .

---------------------------------------------

Here is a "good" test for 1126 :

Input :

5
0
1
2
3
4
5
6
7
8
9
10
10
9
8
7
6
5
4
3
2
1
10
11
12
0
0
0
0
0
1
2
10
2
-1


Output :

4
5
6
7
8
9
10
10
10
10
10
10
9
8
7
6
5
10
11
12
12
12
12
12
0
1
2
10
10
I got the right answer in your test,but still WA
Posted by qwt 6 Apr 2002 19:22
> Excuse me !! This are some tests for 1206 .
>
> ---------------------------------------------
>
> Here is a "good" test for 1126 :
>
> Input :
>
> 5
> 0
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9
> 10
> 10
> 9
> 8
> 7
> 6
> 5
> 4
> 3
> 2
> 1
> 10
> 11
> 12
> 0
> 0
> 0
> 0
> 0
> 1
> 2
> 10
> 2
> -1
>
>
> Output :
>
> 4
> 5
> 6
> 7
> 8
> 9
> 10
> 10
> 10
> 10
> 10
> 10
> 9
> 8
> 7
> 6
> 5
> 10
> 11
> 12
> 12
> 12
> 12
> 12
> 0
> 1
> 2
> 10
> 10
Re: I got the right answer in your test,but still WA
Posted by Vlad Ionescu 8 Jun 2003 02:33
Your problem is in the array constraints:
b:array[0..25000] of integer;
The problem states that the values are between 0 and 100000, so b
[100000] does not exist...
Re: I got the right answer in your test,but still WA
Posted by Vlad Ionescu 8 Jun 2003 02:36
> Your problem is in the array constraints:
> b:array[0..25000] of integer;
> The problem states that the values are between 0 and 100000, so b
> [100000] does not exist...

Got AC with this...
var
  a:array[0..14000] of longint;
  b:array[0..100000] of longint;
  n,i,j,k,max:longint;

begin
{The rest is the same}
end.
Got AC with this...