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