8519: link is as bear

内存限制:128 MB 时间限制:1 S
题面:传统 评测方式:文本比较 上传者:
提交:1 通过:1

题目描述

link, a famous bear magician in Bear Institute of Talented(BIT), has recently learned new magic.

That is, given a array a containing n elements a1,...,an, and link can cast the following magic:

link can choose two integers l,r such that 1lrn, making all ai=xor(l,r) where lir and xor(l,r) denotes the bitwise-xor of all elements in [l,r]. More formally, xor(l,r)=alal+1...ar.

link can cast this magic any time(possibly, zero) and can choose l,rarbitrarily. However, since link has a sort of Obsessive-Compulsive Disorder(OCD), he wants all elements to become the same after his operation. Now, he wonders about the maximum of this same value.

What's more, link finds that the given array has a weird property: there always exists at least one pair of x,y(x!=y) such that ax=ay.

输入格式

The first line contains an integer T(1T3104), the number of the test cases.

The first line of each test case is an interger n(1n105), the length of the array a.

The second line of each test case containing n integers, while the ii-th denoting ai(0ai1015). It's guaranteed that there always exists at least one pair of x,y(x!=y) such that ax=ay.

It's also guaranteed that Σn106.

输出格式

For each test case, output a single intergers indicating the maximum of the same value after link's operations.

输入样例 复制

2
5
10 10 10 10 10
4
1 1 2 1

输出样例 复制

10
3