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

#include <iostream>

using namespace std;

int main()
{
    int m; int n; bool q=false;
    short int a[50000], b[50000];
    cin >> m;
    for (int i=1; i<=m; i++)
        cin >> a[i];
    cin >> n;
    for (int j=1; j<=n; j++)
    {
        cin >> b[j];
        if (!q) for (int i=1; i<=m; i++)
        {
            if ((a[i]+b[j])==10000) { q=true; break; }
            if ((a[i]+b[j])>10000) break;
        }
    }
    if (q) cout << "YES"; else cout << "NO";
    return 0;
}

Where is the error?
arrays first index=0. I changed
short int a[50007], b[50007];
and got AC:
http://acm.timus.ru/status.aspx?space=1&num=1021&author=63786
Thanks very much! Accepted for me!