#Lutece3262. 模线性方程组

模线性方程组

Migrated from Lutece 3262 模线性方程组

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

注:本题不计一血。

已知 nn 元线性一次方程组和素数pp

$ \begin{cases} a_{1, 1} x_1 + a_{1, 2} x_2 + \cdots + a_{1, n} x_n = b_1 \\ a_{2, 1} x_1 + a_{2, 2} x_2 + \cdots + a_{2, n} x_n = b_2 \\ \cdots \\ a_{n,1} x_1 + a_{n, 2} x_2 + \cdots + a_{n, n} x_n = b_n \end{cases}$

请根据输入的数据,编程输出在模素数p的条件下方程组的解的情况。

Input

第一行输入未知数的个数 nn和素数pp
接下来 nn 行,每行 n+1n + 1 个整数,表示每一个方程的系数及方程右边的在模p条件下的值。

Output

如果有唯一解,则输出解。 如果方程组无解输出 1-1; 如果有多解,输出 00

Samples

3 7
2 -1 1 1
4 1 -1 5
1 1 1 0
x1=1
x2=0
x3=6

Constraints

对于 100%100\% 的数据,1n501 \le n \le 50。 对于 1i,jn\forall 1\le i, j \le n,有 ai,j10000|a_{i, j}| \le 10000bi30000|b_i| \le 30000p10000p\le 10000

Resources

2024 UESTC ICPC Training for Math