#include<iostream> #include<cstring> using namespace std; int t, n, x,i,a[10000000],b[10000000] = { 0 }; int main() { cin >> t; while (t--) { //int b[10000000] = { 0 }; //memset(b, 0, sizeof(b)); cin >> n >> x; for ( i = 0; i < n; i++) { cin >> a[i]; b[a[i]]++; } for ( i = 0; i < n; i++) { if (b[x - a[i]] != 0&&x!=2*a[i]) { cout<<"YES"<<endl; break; } else if (b[x - a[i]] >=2) { cout<<"YES"<<endl; break; } } if(i==n) cout<<"NO"<<endl; } return 0; } |
Double click to view unformatted code.