#P17634. [ICPC 2019 Yinchuan R] Image Processing
[ICPC 2019 Yinchuan R] Image Processing
Problem Description
Brabo has images and an image processing APP. The -th image, for any , has a contrast value . To make the images better, the APP receives a batch of images together (which contains at least images) and the contrast between these images should be as close as possible.
Brabo has already known the contrast values of all these images, and now he has to determine a partition splitting images into groups so that each group has at least images, and each image should belong to a certain group. Moreover, the maximal difference of contrast values for images in the same group should be as small as possible. Note that Brabo cannot rearrange the order of these images. That is, each group must contain several images with continuous indexes.
Let's denote as the smallest maximal difference of contrast values for splitting the first images into groups. Your task is to compute these values: . Note that when it is impossible to partition the first images, is regarded as .
Input Format
The first line contains two integers and --- the number of images, and each group of images should contain no less than images.
The next line contains integers --- the encrypted contrast of these images. The actual is , where denotes bitwise exclusive-or. Note that . It is guaranteed that after decryption.
Output Format
Output lines, where the -th line contains a single integer, the smallest contrast differences .
5 2
50 110 190 120 34
0
60
80
90
80
Hint
In the sample test, .