Codeforces Round 134 (Div. 2)
A
Mountain Scenery
Codeforces
1100
原题
←B →
翻译中…

Little Bolek has found a picture with $*n*$ mountain peaks painted on it. The $*n*$ painted peaks are represented by a non-closed polyline, consisting of $2*n*$ segments. The segments go through $2*n* + 1$ points with coordinates $(1, *y*_{1})$, $(2, *y*_{2})$, $...$, $(2*n* + 1, *y*_{2*n* + 1})$, with the $*i*$-th segment connecting the point $(*i*, *y*_{*i*})$ and the point $(*i* + 1, *y*_{*i* + 1})$. For any even $*i*$ $(2 ≤ *i* ≤ 2*n*)$ the following condition holds: $*y*_{*i* - 1} < *y*_{*i*}$ and $*y*_{*i*} > *y*_{*i* + 1}$.

翻译中…

We shall call a vertex of a polyline with an even $*x*$ coordinate a mountain peak.

翻译中…

image The figure to the left shows the initial picture, the figure to the right shows what the picture looks like after Bolek's actions. The affected peaks are marked red, $*k*$ = 2.

翻译中…

Bolek fancied a little mischief. He chose exactly $*k*$ mountain peaks, rubbed out the segments that went through those peaks and increased each peak's height by one (that is, he increased the $*y*$ coordinate of the corresponding points). Then he painted the missing segments to get a new picture of mountain peaks. Let us denote the points through which the new polyline passes on Bolek's new picture as $(1, *r*_{1})$, $(2, *r*_{2})$, $...$, $(2*n* + 1, *r*_{2*n* + 1})$.

翻译中…

Given Bolek's final picture, restore the initial one.

翻译中…

Input

翻译中…

The first line contains two space-separated integers $*n*$ and $*k*$ $(1 ≤ *k* ≤ *n* ≤ 100)$. The next line contains $2*n* + 1$ space-separated integers $*r*_{1}, *r*_{2}, ..., *r*_{2*n* + 1}$ $(0 ≤ *r*_{*i*} ≤ 100)$ — the $*y*$ coordinates of the polyline vertices on Bolek's picture.

翻译中…

It is guaranteed that we can obtain the given picture after performing the described actions on some picture of mountain peaks.

翻译中…

Output

翻译中…

Print $2*n* + 1$ integers $*y*_{1}, *y*_{2}, ..., *y*_{2*n* + 1}$ — the $*y*$ coordinates of the vertices of the polyline on the initial picture. If there are multiple answers, output any one of them.

翻译中…

样例

Input #1
3 2
0 5 3 5 1 5 2
Output #1
0 5 3 4 1 4 2
InputCopy OutputCopy
Input #2
1 1
0 2 0
Output #2
0 1 0
InputCopy OutputCopy
题目信息
题号
218A
时间限制
2 s
内存限制
256 MB
标签
暴力
构造
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。