Logo
(追記) (追記ここまで)

33446번 - Matrices and Determinants 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB93233.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.

제한

예제 입력 1

3
2
2 0
0 2
2
2 1
1 2
1
1

예제 출력 1

Yes
2 0
0 1
1 0
0 2
No
Yes
-1
-1

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2024 > Day 4: Peking U Contest 2 G번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /