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

Could you tell me, where am I wrong? WA test #10
Posted by Alex007 20 Mar 2009 18:14
#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?
Re: Could you tell me, where am I wrong? WA test #10
Posted by OpenGL 22 Mar 2009 14:01
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
Re: Could you tell me, where am I wrong? WA test #10
Posted by Alex007 22 Mar 2009 15:59
Thanks very much! Accepted for me!