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

sos1g3 Подскажите.... [2] // Problem 1021. Sacrament of the Sum 20 Sep 2008 23:01
//int main(){
//    int a[50000];int na;
//    int b[50000];int nb;
//
//    scanf("%i",&na);
//
//    int j=0;int i=0;
//
//    for(i=0;i<=na-1;i++)
//        scanf("%i",&a[i]);
//
//    scanf("%i",&nb);
//    for(j=0;j<=nb-1;j++)
//        scanf("%i",&b[j]);
//
//    i=na-1;j=0;
//    while((a[i]+b[j])>=10000){
//        if ((a[i]+b[j])==10000){
//            printf("YES");return 0;
//        }
//        if (j==nb-1){
//            i--;j=0;}
//
//        if (j<nb-1)
//            j++;
//    }
//
//    printf("NO");
//    return 0;
//}

код моей программы.Она даёт WA на 5ом тесте.Подскажите,что может быть не так...Сам уже голову сломал всю,никак додуматься немагу

Edited by author 20.09.2008 23:03
Sandro (USU) Re: Подскажите.... // Problem 1021. Sacrament of the Sum 21 Sep 2008 11:40
Your algorithm is wrong. Try test:

2
4999
5001
2
5001
1

Good luck!
RedRick[TSOGU] Re: Подскажите.... // Problem 1021. Sacrament of the Sum 9 Nov 2008 11:10
use binary search