TopH SUST Intra University Programming Contest 2019 Subset AND Solution
Problem Link : https://toph.co/p/subset-and
Solution in C++:
/// Author : AH_Tonmoy
#include <bits/stdc++.h>
using namespace std;
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--) {
int n , k , x ;
cin >> n >> k ;
int ans = INT_MAX ;
for ( int i = 0 ; i < n ; i++){
cin >> x ;
ans &= x ;
}
if ( ans < k ) cout <<"YES\n";
else cout <<"NO\n";
}
return 0 ;
}
No comments