#C12230. Matrix Transpose and Determinant

    ID: 41635 Type: Default 1000ms 256MiB

Matrix Transpose and Determinant

Matrix Transpose and Determinant

You are given a matrix with r rows. Your task is to compute the transpose of the matrix. Additionally, if the transposed matrix is square (i.e. the number of rows equals the number of columns), you must also compute its determinant. The determinant for a 2×2 matrix is defined as:

$$\begin{vmatrix} a & b \\ c & d \end{vmatrix} = ad - bc$$

For matrices larger than 2×2, you are expected to use the recursive definition. If the transposed matrix is not square, output an informative message exactly as follows:

The transposed matrix is not square, so the determinant is not defined.

Note that you need to output the transposed matrix first (each row on a separate line with values space-separated), followed by the determinant (or the message) on the last line.

inputFormat

The input is read from stdin. The first line contains an integer r, which represents the number of rows of the matrix. The following r lines each contain space-separated integers that represent a row of the matrix. The matrix may be non-square.

outputFormat

Output to stdout. First, print the transposed matrix with each row on a new line and each number separated by a space. Then print the determinant of the transposed matrix if it is square, or, if not, print the exact message "The transposed matrix is not square, so the determinant is not defined." on the last line.## sample

2
1 2
3 4
1 3

2 4 -2

</p>