CF1777F.Comfortably Numb
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given an array a consisting of n non-negative integers.
The numbness of a subarray al,al+1,…,ar (for arbitrary l≤r ) is defined as max(al,al+1,…,ar)⊕(al⊕al+1⊕…⊕ar), where ⊕ denotes the bitwise XOR operation.
Find the maximum numbness over all subarrays.
输入格式
Each test contains multiple test cases. The first line contains the number of test cases t ( 1≤t≤1000 ). The description of the test cases follows.
The first line of each test case contains a single integer n ( 1≤n≤2⋅105 ).
The second line of each test case contains n integers a1,a2,…,an ( 0≤ai≤109 ).
It is guaranteed that the sum of n over all test cases does not exceed 2⋅105 .
输出格式
For each test case, print one integer — the maximum numbness over all subarrays of the given array.
输入输出样例
输入#1
2 5 1 2 3 4 5 3 10 47 52
输出#1
7 47
说明/提示
For the first test case, for the subarray [3,4,5] , its maximum value is 5 . Hence, its numbness is 3⊕4⊕5⊕5 = 7 . This is the maximum possible numbness in this array.
In the second test case the subarray [47,52] provides the maximum numbness.