xormax

Time limit: 0.5s
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 vL⊕vL+1⊕⋯⊕vRv_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

  • 1≤N≤2â‹…1051 \leq N \leq 2 \cdot 10^5
  • 0≤vi≤1090 \leq v_i \leq 10^9, 1≤i≤N1 \leq i \leq N
# Points Constraints
1 20 N≤500N \le 500
2 20 N≤3 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!