|
|
вернуться в форумI need help Here's my code, it works for every test I make, but it still gives WA on test #14 #include <stdio.h> long a[50000],b[50000],ok=0,i,j=0,n,m; main () { scanf ("%ld",&n); for (i=0;i<n;i++) scanf ("%ld",&a[i]); scanf ("%ld",&m); for (i=0;i<m;i++) scanf ("%ld",&b[i]); for (i=0;i<n;i++) { while ((a[i]+b[j]>10000)&&(j<m)) j++; if (a[i]+b[j]==10000) ok=1;} if (ok) printf ("YES"); else printf ("NO"); } Re: I need help Binary Search and accepted! |
|
|