Doctor Strange and the Exhibition
Time limit1sMemory limit1024 MB
Given n numbers below 4096, decide whether some k of them have a bitwise AND equal to zero.
- Level
Medium7 of 10
- Topics
- Bit manipulation, Combinatorics
- Solved
- No attempts yet
Statement
Doctor Strange has a garden where flower pots are placed in a row. Each pot has a number written on it. The pot at position has the number . In other words, the pots form an array .
A flower exhibition is coming up. Doctor Strange will choose exactly pots for it. He wants his collection to be the most memorable. He also likes patterns, so he believes that if the bitwise AND of the numbers on the chosen pots equals zero, his flowers will leave a lasting impression on everyone.
Help Doctor Strange determine whether he can choose pots that satisfy this condition.
The bitwise AND is a binary operation that applies logical AND to each pair of bits in the same positions of the binary representations of the operands.
Input
The first line contains two positive integers and (, ).
The next line contains non-negative integers ().
Output
If there is a way to choose pots whose bitwise AND equals zero, print YES on the first line. Otherwise, print NO.