all_solutions

(256000 kilobytes, 1000 milliseconds)

Submissions: 0 · Accepted: 0

Submit code

Statement

Complete solution space

Work over \(\mathbb F_p\), where \(p=1\,000\,000\,007\). Given (A\) and
(b), describe every solution of

\[ Ax=b. \]

Input

The first line contains (n,m). The next (n) lines contain the (n\times m)
matrix (A). The final line contains (b\in\mathbb F_p^n).

Output

Print `NO` if the system is inconsistent. Otherwise print `YES`, one particular
solution (x_0) of length (m), then an integer (k), followed by (k)
vectors of length (m). The vectors must form a basis of \(\ker(A)\). Thus all
solutions are exactly

\[ x=x_0+\lambda_1v_1+\cdots+\lambda_kv_k. ## Constraints - \(1\le n,m\le 200\) - Every entry of \(A\) and \(b\) is an integer in \([0,p)\) \]