logo AlgoBeat OnlineJudge
登录 注册

#217583. [ICPC 2019 Yinchuan R] Image Processing

内存限制:512 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

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 .

输入格式

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 lines, where the -th line contains a single integer, the smallest contrast differences .

样例

样例输入 1

5 2
50 110 190 120 34

样例输出 1

0
60
80
90
80

数据范围与提示

In the sample test, .