#bzoj2107. Spoj2832 Find The Determinant III

    ID: 6144 远端评测题 1000ms 256MiB 尝试: 0 已通过: 0 难度: 6.6 上传者: 标签>其他数学线性代数高斯消元bzojspoj

Spoj2832 Find The Determinant III

Title Description

Problem code: DETER3\tt{DETER3}.

Given a NxNNxN matrix AA, find the Determinant of A%PA \% P.

Input format

The first line of every test case contains two integers , representing NN and PP. The following NN lines each contain NN integers, the j-th number in i-th line represents A[i][j]A[i][j] .

Output format

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

Sample

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

Data scale and agreement

For 100%100\% of the data:$0 < N < 201,0<P<100000001,-100000001<A[i][j]<1000000001$.