Codeforces Round 717 (Div. 2)
A
Tit for Tat
Codeforces
800
原题
←B →
翻译中…

Given an array $a$ of length $n$, you can do at most $k$ operations of the following type on it:

翻译中…
  • choose $2$ different elements in the array, add $1$ to the first, and subtract $1$ from the second. However, all the elements of $a$ have to remain non-negative after this operation.
翻译中…

What is lexicographically the smallest array you can obtain?

翻译中…

An array $x$ is lexicographically smaller than an array $y$ if there exists an index $i$ such that $x_i \lt y_i$, and $x_j=y_j$ for all $1 \le j \lt i$. Less formally, at the first index $i$ in which they differ, $x_i \lt y_i$.

翻译中…

Input

翻译中…

The first line contains an integer $t$ ($1 \le t \le 20$) – the number of test cases you need to solve.

翻译中…

The first line of each test case contains $2$ integers $n$ and $k$ ($2 \le n \le 100$, $1 \le k \le 10000$) — the number of elements in the array and the maximum number of operations you can make.

翻译中…

The second line contains $n$ space-separated integers $a_1$, $a_2$, $\ldots$, $a_{n}$ ($0 \le a_i \le 100$) — the elements of the array $a$.

翻译中…

Output

翻译中…

For each test case, print the lexicographically smallest array you can obtain after at most $k$ operations.

翻译中…

Note

翻译中…

In the second test case, we start by subtracting $1$ from the first element and adding $1$ to the second. Then, we can't get any lexicographically smaller arrays, because we can't make any of the elements negative.

翻译中…

样例

Input #1
2
3 1
3 1 4
2 10
1 0
Output #1
2 1 5
0 1
InputCopy OutputCopy
题目信息
题号
1516A
时间限制
1 s
内存限制
256 MB
标签
贪心

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