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 1021. Sacrament of the Sum

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)
Posted by mikhsatyshev 23 Sep 2014 15:45
... a,b:array [1..10000] of integer;...
10000 isn't enough because 1<=n<=50000