| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 9 | 3 | 2 | 33.333% |
Given an $n \times n$ integer matrix $A,ドル you should find two $n \times n$ integer matrices $B$ and $C$ such that $B \cdot C = A$ and $\mathrm{det}(B) = \mathrm{det}(C) \neq 0$. There may exist multiple solutions or no solution.
Note: $\mathrm{det}(M)$ denotes the determinant of matrix $M$.
The first line contains one integer $T$ (1ドル \le T \le 10,000円$) denoting the number of test cases. For each test case:
The first line contains one integer $n$ (1ドル \le n \le 4$) denoting the size of the given matrix.
In the following $n$ lines, the $i$-th line contains $n$ integers $A_{i,j}$ ($|A_{i,j}| \le 10$ for 1ドル \le j \le n$) denoting the given matrix.
For each test case:
The first line must contain one string "Yes" (without quotes) if a solution exists, or "No" (without quotes) if there is no solution. If a solution exists:
Each of the following $n$ lines contains $n$ integers $B_{i,j}$ ($|B_{i,j}| \le 10^{18}$) denoting the matrix $B$.
Each of the following $n$ lines contains $n$ integers $C_{i,j}$ ($|C_{i,j}| \le 10^{18}$) denoting the matrix $C$.
If multiple solutions exist, print any one of them.
3 2 2 0 0 2 2 2 1 1 2 1 1
Yes 2 0 0 1 1 0 0 2 No Yes -1 -1