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

Why I got WA?
Posted by wangchun 7 Jul 2003 12:42
var sz:array[-50000..50000]of boolean;
    can:boolean;
procedure init;
var n,t:word;
    k:integer;
begin
     fillchar(sz,sizeof(sz),0);
     readln(n);
     for t:=1 to n do
         begin
              readln(k);
              sz[10000-k]:=true;
         end;
end;
procedure make;
var m,t:word;
    k:integer;
begin
     can:=false;
     readln(m);
     for t:=1 to m do
         begin
              readln(k);
              if sz[k] then
                 can:=true;
         end;
end;
procedure print;
begin
     if can then
        writeln('YES')
            else
        writeln('NO');
end;
begin
     init;
end.
Re: Why I got WA?
Posted by ahmasoi 17 Jul 2004 09:27
in your program's init
k is integer ,while k=-32767 or others then
10000-k is out of integer, it's answer is wrong!
please check!