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 test 14! Help please
Posted by Den 4 Jun 2009 21:45
#include <stdio.h>
int binsup(int key,int *mas,int n);
int binsdown(int key,int *mas,int n);
int main()
{
int mas[50100],mas1[50100],i,n,n1,f;
scanf("%d",&n);
for (i=0; i<n; i++) scanf("%d",&mas[i]);
scanf("%d",&n1);
for (i=0; i<n1; i++) scanf("%d",&mas1[i]);
f=0;
if (n>n1)
  for (i=0; i<n1 && f==0; i++) f=binsup(10000-mas1[i],mas,n);
else
  for (i=0; i<n && f==0; i++) f=binsdown(10000-mas[i],mas1,n1);
if (f==0) printf("NO"); else printf("YES");
return 0;
}
int binsup(int key,int *mas,int n)
{
int lg,pg,m;
lg=0; pg=n;
while (lg<=pg)
  {
    m=(lg+pg)/2;
    if (key>mas[m]) lg=m+1;
    else if (key<mas[m]) pg=m-1;
    else return 1;
  }
return 0;
}
int binsdown(int key,int *mas,int n)
{
int lg,pg,m;
lg=0; pg=n;
while (lg<=pg)
  {
    m=(lg+pg)/2;
    if (key<mas[m]) lg=m+1;
    else if (key>mas[m]) pg=m-1;
    else return 1;
  }
return 0;
}
//-------------------------
what i do wrong?
Re: WA test 14! Help please
Posted by sergy93 30 Oct 2013 12:37
Did u find test #14?
Give me this test pls...