View Code of Problem 133

# include <stdio.h>

int a[10000000]={0},b[10000000];

  void f(int n,int x)
  {
	  int i;
	  for(i=0;i<n;i++)
	  {
		  scanf("%d",&b[i]);
			  if(b[i]>=0)
				  a[b[i]]=1;
			  else
				  a[b[i]]=-1;
	  }
	  for(i=0;i<n;i++)
		  if(a[x-b[i]]==1||a[b[i]-x]==-1)
			  break;
		  if(i<n)
			  printf("YES\n");
		  else
			  printf("NO\n");
  }
  int main()
  {
	  int i,t,n,x;
	  scanf("%d",&t);
	  while(t--)
	  {
		  scanf("%d%d",&n,&x);
		  f(n,x);
	  }
  }

Double click to view unformatted code.


Back to problem 133