#include<iostream> using namespace std; int main() { int t; cin>>t; while(t--) { int n,x; cin>>n>>x; int a[n]; for(int i=0;i<n;i++) cin>>a[i]; bool flag=false; for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { if(i!=j) { int temp=a[i]+a[j]; if(temp==x) { flag=true; } } } } if(flag) cout<<"YES"<<endl; else cout<<"NO"<<endl; } } |
Double click to view unformatted code.