xormax

Time limit: 0.3s
Memory limit: 256MB
Input:
Output:

Task

You are given an integer NN, followed by NN positive integers, the ii-th number being viv_i. You are asked to find out the maximum xor sum you can get by choosing a continuous subarray.

A subarray (L,R)(L, R) is defined as the sequence that contains all values from the LthL^{th} one to the RthR^{th} one, and its xor sum is given as vLvL+1vRv_L \oplus v_{L+1} \oplus \dots \oplus v_R, where \oplus is the operator for XOR on bits.

Input data

The first line will contain the integer NN. The second line will contain NN integers.

Output data

The first line will contain the required answer.

Constraints and clarifications

  • 1N1051 \leq N \leq 10^5
  • 0vi2290 \leq v_i \leq 2^{29}, 1iN1 \leq i \leq N
# Points Constraints
1 20 N500N \le 500
2 20 N3 000N \le 3\ 000
3 60 No additional constraints

Example 1

stdin

6
0 1 2 3 5 4

stdout

6

Explanation

The subarray with the maximum xor sum is (4,5)(4, 5).

Example 2

stdin

10 
1 2 100 12 3 0 12 4 0 1

stdout

107

Problem info

ID: 1984

Editors:

Tags:

Log in or sign up to be able to send submissions!