#56767. 异或区间
异或区间
暂无测试数据。
云浅有一个长为 $n$ 的序列 $a$。
请你求出 $a$ 的一个非空的连续子段,使得这一段里所有数的异或和最小。
形式化地,你需要找到一个区间 $[l,r]$,最小化
$$\displaystyle \displaystyle a_l\ \text{xor}\ a_{l+1}\ \text{xor}\ \cdots\ \text{xor}\ a_r $$
其中 $xor$ 代表异或,在 C++
程序中异或符号为:^
。
的值。
输入格式
第一行一个正整数 $n$ 表示序列长度。
第二行 $n$ 个正整数分别表示 $a_1,a_2,\cdots,a_n$。
输出格式
输出一行一个正整数表示最小的异或和。
数据范围
数据点编号 | 数据点约束 |
---|---|
$1\sim 2$ | $n\le 100,a_i<128$ |
$3\sim 6$ | $n\le 1000,a_i<2^{20}$ |
$7\sim 8$ | $n\le 2\times 10^5,a_i<1024$ |
$9\sim 12$ | $n\le 2\times 10^5,a_i<2^{20}$ |
$13\sim 20$ | 无特殊限制 |
对于 $100\%$ 的数据,$1\le n\le 2\times 10^5,0\le a_i < 2^{31}$。
5
12 34 56 78 90
2
5
19 28 37 46 55
4