|
||||||||||
Baby Ming and Binary imageTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 405 Accepted Submission(s): 155 Problem Description 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$. Input 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$ Output 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) Sample Input
Sample Output
Hint in the second sample, the matrix[1 0 0] is not Baby Ming's Matrix, so there is no answer Source | ||||||||||
|