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

WA #11
Posted by h1ci 15 Jun 2009 23:06
Please HELP!!! give me tests or say what is wrong:
#include <iostream>
using namespace std;
int is[128000];
int main()
{
    int n, n1, a, c=10000;
    cin >> n;
    for(int i=0; i<n; i++)
    {
            cin >> a;
            if(a>=0) is[a]=1;
            else is[a-2*a+32767]=1;
    }
    cin >> n1;
    bool kl=false;
    for(int i=0; i<n1; i++)
    {
            cin >> a;
            if(a<c && c-a<=32767) if(is[c-a]) { cout << "YES" << endl; return 0;}
            if(a>c) if(is[a-c+36767]) { cout << "YES" << endl; return 0;}
    }
    cout << "NO" << endl;
    return 0;
}