2107 - Spoj2832 Find The Determinant III

Problem code: DETER3 Given a NxN matrix A, find the Determinant of A % P. 给出一个尺寸为N×N的整数方阵A(N≤200),要求求出|A|%P的值(即A的行列式的值除以P的余数)。方阵中的数与P均为32位有符号类型可容纳的整数

输入

The first line of every test case contains two integers , representing N (0 < N < 201) and P (0 < P < 1,000,000,001). The following N lines each contain N integers, the j-th number in i-th line represents A[i][j] (- 1,000,000,001 < A[i][j] < 1,000,000,001).

输出

For each test case, print a single line contains the answer.

样例

输入

3 4
-840419217 -895520213 -303215897
537496093 181887787 -957451145
-305184545 584351123 -257712188

输出

2
时间限制 1 秒
内存限制 128 MB
讨论 统计
上一题 下一题