#P17204. 「DLESS-6」XOR and MEX
「DLESS-6」XOR and MEX
Background
The input size of this problem is large. Please use a fast input method.
Problem Description
Given a sequence of length , let be $\operatorname{mex}(a_1\oplus x,a_2\oplus x,\ldots,a_n\oplus x)^{\dagger}$. Find . Here, denotes the bitwise XOR operation.
For natural numbers , denotes the smallest non-negative integer that does not appear among .
Input Format
This problem has multiple test cases. The first line contains a positive integer , representing the number of test cases.
For each test case:
- The first line contains a positive integer .
- The second line contains numbers, representing the sequence .
Output Format
For each test case, output one line with one number, representing the answer.
3
5
1 4 5 2 6
6
0 1 4 5 2 6
3
0 1 3
0
3
2
Hint
[Sample Explanation]
For the first test case, take , then . Obviously, there cannot be an answer smaller than .
For the second test case, take , then . It can be proven that is the minimum value of .
[Constraints]
For all testdata, it is guaranteed that:
- ;
- ;
- .
The special properties of each test point are as follows:
| Test Point ID | ||
|---|---|---|
| ^ | ||
| ^ | ||
Translated by ChatGPT 5