My issue
single element of an array can also be called as its subsequence then why it is giving NO on test case [1,3,5] n=3 b=2; it should be yes?
My code
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
int t;
cin>>t;
while(t--)
{
ll n,b;
cin>>n;
// vector<ll> v;
int flag =0;
for(ll i =0; i<n ;i++)
{
ll x;
cin>>x;
if((x & b)==b && flag==0)
{
cout<<"YES"<<"\n";
flag=1;
//break;
}
}
if(flag==0)
{
cout<<"NO"<<"\n";
}
}
// your code goes here
return 0;
}
Problem Link: CS2023_PON Problem - CodeChef