406548: GYM102439 B Varvara and matrix

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Varvara and matrixtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Someone has gifted Varvara matrix $$$n \times m$$$, which consists of numbers from $$$0$$$ to $$$k$$$. Each row and each column of this matrix has at most one $$$0$$$.

Let the beauty of matrix be the number of different rectangles which have equal numbers on all four corners of this rectangle. Formally, the beauty of the matrix is the number of different sets $$$\{x_1, x_2, y_1, y_2\}$$$, where «$$$1 \le x_1 < x_2 \le n$$$», «$$$1 \le y_1 < y_2 \le m$$$» and «$$$a_{x_1, y_1} = a_{x_1, y_2} = a_{x_2, y_1} = a_{x_2, y_2}$$$».

Varvara is interested in the following question: can she replace each $$$0$$$ in matrix with integers $$$A$$$ or $$$B$$$, in such a way that the beauty of matrix won't change. Note that each $$$0$$$ is replaced independently.

Input

The first line contains two integers $$$n$$$ and $$$m$$$, denoting the number of rows and columns of the matrix respectively. The second line contains a single integer $$$k$$$. The third line contains two integers $$$A$$$ and $$$B$$$ denoting the numbers which can be used to replace $$$0$$$ in matrix. Each of the following $$$n$$$ lines contain $$$m$$$ space-separated integers $$$a_{i, j}$$$ denoting the given matrix.

$$$$$$2 \le n, m \le 10^3$$$$$$ $$$$$$2 \le k \le n \cdot m$$$$$$ $$$$$$1 \le A, B \le k, A \neq B$$$$$$ $$$$$$0 \le a_{i, j} \le k$$$$$$

Output

Print «Yes» and $$$n$$$ lines with the matrix after replacing all $$$0$$$ if it is possible to keep the same beauty of the matrix. Otherwise, print a single line «No».

ExamplesInput
4 4
5
3 5
1 1 0 3
0 5 4 5
1 1 4 4
2 5 3 0
Output
Yes
1 1 5 3
5 5 4 5
1 1 4 4
2 5 3 3
Input
4 4
4
1 2
1 1 3 3
1 0 2 3
1 2 0 3
1 3 1 3
Output
No

加入题单

算法标签: