NEED HELP ON THIS PROBLEM

Правка en2, от javacoder1, 2016-03-11 20:21:15

Given N numbers and K, find out if there exists a subset of numbers such that their bitwise xor is K.

Input

First line contains N and K. The second line contains N space-separated integers A1, A2, ..., AN denoting the N numbers.

Output

Output "Yes" if such subset exists, "No" otherwise.(without quotes) Constraints

1 ≤ N ≤ 200

1 ≤ K,Ai ≤ 109

Example

Input: 4 101

1 2 100 1000

Output: Yes

Explanation

Example case 1. We can take xor of 1 and 100 to get 101 Note

Bitwise xor of a subset A1, A2, .., AN is equal to (..(A1 xor A2) xor A3).. AN).Each bit of bitwise xor of two numbers is calculated separately. The result in each position is 1 if only the first bit is 1 or only the second bit is 1, but will be 0 if both are 0 or both are 1. For example, bitwise xor of 1(01) and 3(11) is 2 (10).

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en5 Английский javacoder1 2016-03-11 22:26:16 64
en4 Английский javacoder1 2016-03-11 21:43:26 3
en3 Английский javacoder1 2016-03-11 20:42:01 1 Tiny change: ' K,Ai ≤ 109\n \nExam' -> ' K,Ai ≤ 10^9\n \nExam'
en2 Английский javacoder1 2016-03-11 20:21:15 9
en1 Английский javacoder1 2016-03-11 20:20:09 862 Initial revision (published)