Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define _test int _TEST; cin>>_TEST; while(_TEST--)
- #define ff first
- #define ss second
- #define pb push_back
- #define ppb pop_back
- int main()
- {
- ios_base::sync_with_stdio(false);
- cin.tie(NULL);
- cout.tie(NULL);
- _test
- {
- int n, b;
- cin>>n>>b;
- vector<int> a(n);
- for(auto &e: a)
- cin>>e;
- int ok=0;
- ll int x = ((1ll)<<30) - 1;
- for(auto e: a)
- {
- if((e&b) == b)
- x &= e, ok=1;
- }
- if(x == b && ok)
- cout<<"YES\n";
- else
- cout<<"NO\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment