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 wa4?
Posted by LGH 23 Jul 2009 13:04
I use binary array. Where is wrong?

long n,m,i,k;
long p[65539];
int Ok=0;
cin>>n;
for(i=0;i<65539;i++){p[i]=0;}
for(i=0;i<n;i++){cin>>k; p[k+32768]=1;}
cin>>m;
for(i=0;i<m&&!Ok;i++){cin>>k; if (p[42768-k]){Ok=1;}}
if (Ok) {cout<<"YES";}
else {cout<<"NO";}