luogu#P4783. 【模板】矩阵求逆
【模板】矩阵求逆
Problem Description
Find the inverse matrix of an matrix. Output the answer modulo .
Input Format
The first line contains an integer , which represents the size of the matrix.
The next lines each contain integers. The number in row and column represents the element of the matrix.
Output Format
If the matrix is invertible, output lines, each containing integers. The number in row and column represents the element of the inverse matrix, taken modulo .
Otherwise, output only one line: No Solution.
3
1 2 8
2 5 6
5 1 2
718750005 718750005 968750007
171875001 671875005 296875002
117187501 867187506 429687503
3
3 2 4
7 2 9
2 4 3
No Solution
Hint
For of the testdata, .
For of the testdata, , and all .
Translated by ChatGPT 5