| 
 | 
back to boardWhy I have got crush? Why I have got crush? #include<stdio.h> int main () {     int n1, n2, i;     int temp;     bool flag=false;     bool a[35000];     for (i=0; i<35000; i++)         a[i]=false;     scanf ("%i", &n1);     for (i=0; i<n1; i++)     {         scanf ("%i", &temp);         if (temp<0) temp=-temp;         a[temp]=true;     }     scanf ("%i", &n2);     for (i=0; i<n2; i++)     {         fscanf (f, "%i", &temp);         if (a[10000-temp]==true) flag=true;         if (flag == true) break;     }     if (flag == true) printf("YES");     else     printf("NO");     return 0; } Re: Why I have got crush? Posted by  Madhav 13 Jun 2008 02:11 what you do is that take an bool array of length 65000. and for every number you take as input add 33,000 or something(some offset) to make every number >=0 and then do the same thing as u did now but in this case u search for 10000+offset  |  
  | 
|