시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 64 MB | 44 | 25 | 24 | 64.865% |
Slavko is bored, so he’s filling out an N N table with positive integers. ×
He’s particularly happy if he manages to fill out the table so that the following conditions are
met:
Help Slavko find a table that will make him happy.
The first line of input contains the integer N (1 ≤ N ≤ 100).
Output N lines, in each line output N integers separated by space.
Let the jth number in the ith line correspond to the value that Slavko will write down in the ith row and jth column of the table.
All numbers must be greater than 0 and smaller than 1 000 000 000.
If there are multiple solutions, output any.
If there is no solution, output -1.
3
1 2 3 4 5 6 7 8 9
2
-1
The averages of individual rows are, respectively: 2, 5, 8.
The averages of individual columns are, respectively: 4, 5, 6.
Since the average of each row is located in the correspoding row and the average of each column is
located in the corresponding column, the output table will make Slavko happy.
Contest > Croatian Open Competition in Informatics > COCI 2016/2017 > Contest #2 4번