当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

7184:Link is as bear

题目描述
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 $a_{1},...,a_{n}$, and Link can cast the following magic:

Link can choose two integers $l,r$ such that $1\leq l \leq r \leq n$, making all $a_{i}=xor(l,r)$ where $l\leq i\leq r$ and $xor(l,r)$ denotes the bitwise-xor($\oplus$) of all elements in $[l,r]$. More formally, $xor(l,r)=a_l\oplus a_{l+1}\oplus ... \oplus a_r$.

Link can cast this magic any time(possibly, zero) and can choose $l,r$ arbitrarily. 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\neq y)$ such that $a_x= a_y$.
输入解释
The first line contains an integer $T(1\leq T \leq 3*10^4)$, the number of the test cases.

The first line of each test case is an interger $n(1\leq n\leq 10^5)$, the length of the array $a$.

The second line of each test case containing $n$ integers, while the $i$-th denoting $a_i(0\leq a_i \leq 10^{15})$. It's guaranteed that there always exists at least one pair of $x,y(x\neq y)$ such that $a_x= a_y$.

It's also guaranteed that $\Sigma n \leq 10^6$.
输出解释
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

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-7184

最后修改于 2022-09-15T06:17:13+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
4000/2000MS(Java/Others) 262144/131072K(Java/Others)