#include "stdlib.h" #include "algorithm" #include "iostream" #include <cstdio> #include "string" #include <iomanip> #include <map> #include <set> #include "math.h" using namespace std; map<int, bool> mp; set<string> st; int main() { int t, n, x, tmp; cin >> t; string str; while (t--) { int flag = 0; int i = 0; cin >> n >> x; for (i = 0; i < n; i++) { cin >> tmp; if (tmp < x) { mp[tmp] = true; if (mp[x - tmp] == true) { flag = 1; break; } } } if (i != n - 1)getline(cin,str); if (flag == 0)cout << "NO" << endl; else cout << "YES" << endl; mp.clear(); } return 0; } |
Double click to view unformatted code.