F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Link is as bear

Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 262144/131072 K (Java/Others)
Total Submission(s): 1454    Accepted Submission(s): 570


Problem Description
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$.
 

Input
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$.
 

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

Sample Input
2 5 10 10 10 10 10 4 1 1 2 1
 

Sample Output
10 3
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 01:56:51, Gzip enabled