Problems
Determinant of the matrix
Determinant of the matrix
Find the matrix of size n × n such that its determinant equals to a given number k. The elements of the matrix must be integers from 0 to k - 1.
Input
Contains two integers n and k (1 ≤ n ≤ 100, 1 ≤ k ≤ 106
) - the dimension of the matrix and the value of the determinant.
Output
If the required matrix does not exist, print Impossible. Otherwise print n lines of n integers each. Numbers must be within [0, k - 1]. In this case, the determinant of the printed matrix must be equal to k.
Input example #1
3 5
Output example #1
3 1 1 1 2 2 3 1 2