#1711. 最大异或子数组

最大异或子数组

题目描述

给出一个正整数序列,求异或和最大的连续子段和。

即你要选择一个连续的数字区间,使得 alal+1ara_l\oplus a_{l+1}\oplus \cdots \oplus a_r 的结果最大。

其中 \oplus 为异或的数学符号。

输入格式

第一行一个数 nn

第二行 nn 个整数,a1,a2,,ana_1,a_2,\cdots,a_n

输出格式

一个数,即最大的异或和。

5
1 2 1 1 2
3
3
1 2 7
7
4
4 2 4 8
14

提示

1n2000,1ai1091\leq n\leq 2000,1\leq a_i\leq 10^9