XOr
Time limit1sMemory limit1024 MB
Split an array into exactly m consecutive parts so the OR of the parts' XOR sums is as small as possible, and print that minimum.
- Level
Hard8 of 10
- Topics
- Bit manipulation, Greedy, Prefix sum, Dynamic programming
- Solved
- No attempts yet
Problem
bobo has a sequence of integers . He divides the sequence into exactly consecutive parts.
The cost of each part is its xor sum (bitwise exclusive-or). The cost of the division is the bitwise or sum of the costs of its parts.
Help bobo find the minimum cost.
Input
The first line contains two integers , (). The second line contains integers ().
Output
Print the minimum cost as a single integer.