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

Most View Post

Recent post

RESTful APIs with CRUD Operations in Laravel 12| (2025)

  RESTful APIs serve as the foundation of modern web development. They follow a set of rules called Representational State Transfer (REST) t...

Powered by Blogger.