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

Common Board

Question to Bace Mihai.
Posted by WuLF 5 Mar 2005 20:55
Why I have Crash(ACCESS_VIOLATION) on third test?

{@Judge_ID: 34711UL 1209 Pascal}
var a,b:array [1..8000] of longint;
    w,q,i,n,j,k,l:longint;
    bol:boolean;
begin
 readln(n);
 if n<0 then halt;
 for i:=1 to n do
 begin
  readln(k);
  q:=q+1;
  b[q]:=k;
 end;
 a[1]:=1;
 a[2]:=2;
 for j:=3 to 100 do
 begin
  a[j]:=a[j-1]+j-1;
  w:=w+1;
 end;
 i:=0;
 j:=0;
 for j:=1 to q do
 begin
  bol:=true;
  for i:=1 to w do
  begin
   if b[j]=a[i] then
   begin
     write('1',' ');
    bol:=false;
   end;
  end;
  if bol=true then write('0',' ');
 end;
end.