当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5613:Baby Ming and Binary image

题目描述
Baby Ming likes to deal with pixel map in the following way:

First, converting the pixel map into binary image (recorded as 01), and then, in the binary figures, for each grid, add up the grid and its neighboring grids’ binary number, and store in matrix <b>$Mat$</b>.

All the pictures Baby Ming chosen have a <b>blank upper margin and bottom margin</b> (the value of which is 0 in the binary image), because he thinks such a picture is beautiful.

The matrix $Mat$ is so big that Baby Ming is worried about the mistakes in the matrix. So he wants to know whether the binary image can be regained according to the $Mat$.

输入解释
In the first line contains a single positive integer $T$, indicating number of test case.

In the second line there are two numbers $n, m$, indicating the size of the binary image and the size of the matrix $Mat$

In the next $n$ lines, each line input m numbers, indicating the matrix $Mat$.

$1 \leq T \leq 30, 2 < n \leq 12, m \leq 100$
输出解释
Print <b>Impossible</b>, if it is impossible to regain the binary image.

Print <b>Multiple</b>, if it has more than one result.

Otherwise, print the binary image (Baby Ming's 01 matrix)
输入样例
2
4 4
1 2 3 2
2 3 4 2
2 3 4 2
1 1 1 0
3 1
1
1
0
输出样例
0 0 0 0
0 1 1 1
0 1 0 0
0 0 0 0
Impossible


提示
in the second sample, the matrix[1 0 0] is not Baby Ming's Matrix, so there is no answer
来自杭电HDUOJ的附加信息
Recommend hujie

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-5613

最后修改于 2020-10-25T23:24:12+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 65536/65536K(Java/Others)