Mexor
Execution time limit is 2 seconds
Runtime memory usage limit is 256 megabytes
You are given an array consisting of non-negative integers, and m queries. Each query is characterized by one number and consists of the following consecutive steps:
Perform the bitwise addition operation modulo 2 (xor) of each array element with the number ;
Find mex of the resulting array.
Note that after each query the array changes.
Input
First line contains two integer numbers and — number of elements in array and number of queries.
Next line contains integer numbers — elements of then array.
Each of next m lines contains query — one integer number .
Output
For each query print the answer on a separate line.
Examples
Mex of a sequence of numbers is the minimum non-negative number that is not present in the sequence as element. For example, and .
Input #1
Answer #1
Input #2
Answer #2
Input #3
Answer #3
Submissions 36
Acceptance rate 31%