#Lutece1454. Stabilization
Stabilization
Migrated from Lutece 1454 Stabilization
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
The instability of a array A with length N is defined as . In order to stabilize a array, changing every element A[i] to (A[i] xor X) is allowed. What is the smallest non-negative integer X to minimize the instability of a given array?
Input
There are multiple test cases. The first line of input contains an integer T, indicating the number of test cases.
For each test case, the first line contains an integer N. Next line contains N integers, indicating the elements of the array.
T<=10, 0<=A[i]<2^20, 1<=n<=10^5.
Output
For each test case, output two integers in one line, the smallest non-negative integer X and the minimum of the instability.
Samples
2
3
0 3 0
3
1 3 1
1 2
0 4
Resources
2016 Multi-University Training Contest 6