## PIB '20 P5 - 4D Matrices

View as PDF

Points: 10 (partial)
Time limit: 0.5s
Memory limit: 256M

Author:
Problem type

You are given a grid of size .

Using this grid, you are to generate a new grid of size as follows:

1. The first element in each row will be assigned a value of . The array is unknown to you.
2. For each element in row , .

A third array, will then be generated as follows:

1. The element is the median of the column in .

It is known that the median of the array is exactly zero. Can you determine any array that makes the median of zero, or state that it is impossible?

Note: For odd , the median of the array is the middle element in the sorted array. For even , the median is the minimum of the two middle elements in the sorted array. For example, the median of is .

#### Input Specification

The first line will contain the integer .

The next lines will each contain integers, .

#### Output Specification

If it is impossible, print NO on one line.

Otherwise, print YES on the first line.
On the second line, print space separated integers, the array . must fit in a 32-bit integer , or you will receive Wrong Answer.

No further constraints.

#### Sample Input For Subtask 1

4
2 1 0
3 3 0
1 6 1
1 1 1

#### Sample Output For Subtask 1

YES
-1 -3 -2 0

#### Explanation For Sample For Subtask 1

The array that is generated with the array below is:

-1  1  2  2
-3  0  3  3
-2 -1  5  6
0  1  2  3
-----------
-2  0  2  3

The median of the array is . Note that there could be multiple answers. For example, is also an answer. You are only required to print any one of them.

#### Sample Input For Subtask 2

7
1 2 2 2 1 1
3 0 0 1 1 1
0 0 0 0 0 0
1 0 2 1 0 1
2 0 0 1 4 0
2 1 1 2 4 5
1 1 1 1 1 1

#### Sample Output For Subtask 2

YES
5 1 -2 -3 1 -5 -8

#### Sample Input For Subtask 3

3
3 -12
-6 3
6 -5

#### Sample Output For Subtask 3

YES
-1 5 -1