Sum
Time limit3sMemory limit512 MB
Given an n by m matrix modulo a prime p, find K rank-one style pairs of vectors b and c whose sum of outer products equals the matrix, with nonzero row and column sums.
- Level
Hard8 of 10
- Topics
- Matrix, Math, Implementation
- Solved
- No attempts yet
Statement
Given a rectangular array of size and a prime number , find two rectangular arrays, of size and of size , such that:
- ()
- ()
- ()
- ()
- ()
Input
The first line contains four positive integers , , , (; ; is prime).
The -th of the following lines contains integers ().
Output
If there is no solution, print a line No solution!.
Otherwise, print lines. The -th line contains integers .
If there are several possible answers, print any one of them.