|
|
вернуться в форумI got AC,using hash list Послано ufx 3 апр 2003 07:54 here is my program,please check it. program ex; const maxn=32767; var f:array[-32768..32767] of boolean; n1,n2,i,x,y:longint; flag:boolean; begin readln(n1); fillchar(f,sizeof(f),0); for i:=1 to n1 do begin readln(x); f[x]:=true; end; readln(n2); flag:=false; for i:=1 to n2 do begin readln(x); y:=10000-x; if (y>=-32768) and (y<=32767) then if f[y] then begin flag:=true; break; end; end; if flag then writeln('YES') else writeln('NO'); end. |
|
|