Matrix Determinant mod p
Compute the determinant of an N×N integer matrix modulo 109+7.
Input: the first line has N; the next N lines give the matrix rows.
Output: the determinant mod 109+7 (in [0, p−1]).
Constraints:
- 1 ≤ N ≤ 300
- 0 ≤ entries < 109+7
Sample Tests
Input 1
2 1 2 3 4
Output 1
1000000005
Input 2
1 7
Output 2
7
Input 3
2 2 4 1 2
Output 3
0
Discussion (opens after you solve — no spoilers before)
No comments yet.