CF1847C.Vampiric Powers, anyone?
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
DIO knows that the Stardust Crusaders have determined his location and will be coming to fight him. To foil their plans he decides to send out some Stand users to fight them. Initially, he summoned n Stand users with him, the i -th one having a strength of ai . Using his vampiric powers, he can do the following as many times as he wishes:
- Let the current number of Stand users be m .
- DIO chooses an index i ( 1≤i≤m ).
- Then he summons a new Stand user, with index m+1 and strength given by: $$$$a_{m+1} = a_i \oplus a_{i+1} \oplus \ldots \oplus a_m, $$
where the operator oplus denotes the bitwise XOR operation.
- Now, the number of Stand users becomes m+1$$.
Unfortunately for DIO, by using Hermit Purple's divination powers, the Crusaders know that he is plotting this, and they also know the strengths of the original Stand users. Help the Crusaders find the maximum possible strength of a Stand user among all possible ways that DIO can summon.
输入格式
Each test contains multiple test cases. The first line contains the number of test cases t ( 1≤t≤10000 ). The description of the test cases follows.
The first line of each test case contains a single integer n ( 1≤n≤105 ) – the number of Stand users initially summoned.
The second line of each test case contains n integers a1,a2,…,an ( 0≤ai<28 ) – the strength of each Stand user.
It is guaranteed that the sum of n over all test cases does not exceed 105 .
输出格式
For each test case, output a single integer, maximum strength of a Stand user among all possible ways that DIO can summon.
输入输出样例
输入#1
3 4 0 2 5 1 3 1 2 3 5 8 2 4 12 1
输出#1
7 3 14
说明/提示
In the first test case, one of the ways to add new Stand users is as follows:
- Choose i=n . Now, a becomes [0,2,5,1,1] .
- Choose i=1 . Now, a becomes [0,2,5,1,1,7] . 7 is the maximum strength of a Stand user DIO can summon.
In the second test case, DIO does not need to add more Stand users because 3 is the maximum strength of a Stand user DIO can summon.