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