Help. Runtime error (access violation)

Posted by

Daniel 23 Jul 2014 15:06

Where is my wrong?

Why runtime error (access violation)?

This is my code-

program _1021;

var

n,i,k,l,m:integer;

a,b:array[1..10000] of integer;

begin

read(n);

for i:=1 to n do

read(a[i]);

read(m);

for k:=1 to m do

read(b[k]);

for i:=1 to n do

for k:=1 to m do

if a[i]+b[k]=10000 then

l:=l+1;

if l>=1 then writeln('YES')

else

writeln('NO');

end.

Re: Help. Runtime error (access violation)

... a,b:array [1..10000] of integer;...

10000 isn't enough because 1<=n<=50000