#Qua2201. Bitwise Password
Bitwise Password
Description
Libra wrote down an array of non-negative integers . For each continuous subsequence of the array, Libra can calucate its bitwise-xor sum: $a_l\;\mathrm{xor}\;a_{l+1}\;\mathrm{xor}\;\dots \;\mathrm{xor}\; a_r$. (xor represents ^
in C/C++)
Libra gives you queries, each of which is described by an integer . For each query, you need to find a continuous subsequence with minimum value of , where is the bitwise-xor sum of the subsequence. You should tell Libra the length of the corresponding sequence.
If there are multiple subsequences that meet the conditions, tell Libra the longest length of these subsequences.
Format
Input
The first line contains one integer --- the number of test cases.
Each test case consists of two lines.
The first line contains non-negative integers. The first number is --- the length of the array. The next numbers describe the array Libra wrote down.
The first line contains integers. The first number is --- the number of queries. The next numbers describe the queries.
Output
For each test case, print lines. The first lines contains the answer to the queries, and the -th line left empty.
Samples
2
2 1 1
2 0 2
3 1 2 4
3 10 5 1
2
1
3
2
1
相关
在下列比赛中: