← 返回题目列表

Codeforces · 1438/C

C. 工程师阿尔乔姆

中文机器翻译题面 查看原题

Artem 正在建造一个新机器人。他有一个矩阵 $$$a$$$,由 $$$n$$$ 行和 $$$m$$$ 列组成。 The cell located on the $$$i$$$-th row from the top and the $$$j$$$-th column from the left has a value $$$a_{i,j}$$$ written in it.

If two adjacent cells contain the same value, the robot will break.如果没有两个相邻单元包含相同的值,则矩阵被称为良好矩阵,其中如果两个单元共享一条边,则称为相邻矩阵。

Artem wants to increment the values in some cells by one to make $$$a$$$ good.

More formally, find a good matrix $$$b$$$ that satisfies the following condition —

- For all valid ($$$i,j$$$), either $$$b_{i,j} = a_{i,j}$$$ or $$$b_{i,j} = a_{i,j}+1$$$.

For the constraints of this problem, it can be shown that such a matrix $$$b$$$ always exists. If there are several such tables, you can output any of them.请注意,您不必最小化增量数量。

输入

每个测试包含多个测试用例。第一行包含测试用例的数量 $$$t$$$ ($$$1 \le t \le 10$$$)。测试用例的描述如下。

每个测试用例的第一行包含两个整数 $$$n, m$$$ ($$$1 \le n \le 100$$$, $$$1 \le m \le 100$$$) — 分别是行数和列数。

以下 $$$n$$$ 行每行包含 $$$m$$$ 整数。第 $$$i$$$ 行中的第 $$$j$$$ 整数为 $$$a_{i,j}$$$ ($$$1 \leq a_{i,j} \leq 10^9$$$)。

输出

对于每种情况,输出 $$$n$$$ 行,每行包含 $$$m$$$ 整数。第 $$$i$$$ 行中的第 $$$j$$$ 整数是 $$$b_{i,j}$$$。

示例

输入 #1

3
3 2
1 2
4 5
7 8
2 2
1 1
3 3
2 2
1 3
2 2

输出 #1

1 2
5 6
7 8
2 1
4 3
2 4
3 2

注意

在所有情况下,您都可以验证没有两个相邻单元格具有相同的值,并且 $$$b$$$ 与 $$$a$$$ 相同,但某些值增加了 1。