Subset AND
Practice
3.6 (35 votes)
Ad Hoc
Approved
Basic programming
Easy
Open
Problem
58% Success 15103 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

You are given a number Z and a set S with N elements. Your job is to find a sub set of S such that the AND of the given number and this subset is zero. If this sub set is possible print "Yes" otherwise print "No"

Input
First line contains number of test case T. Each test case contains two lines , first line contains two numbers Z and N , where Z is given number and N is size of set S . Second line contains N elements of the subset S.

Output
For each test case print Yes if the subset is possible else print No .

Constraints:
1<=T<=100
1<=N<=1000
0<=Ai<=Z<=1000000

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
14 votes
Tags:
Bit manipulationBit ManipulationBasics of Bit ManipulationBasic Programming
Points:20
14 votes
Tags:
Basic ProgrammingBit Manipulation
Points:30
150 votes
Tags:
ReadyBrute-force searchEasy-MediumApprovedBreadth-first search