Construct matrix of ones and zeros based on sequences

We are given ($a_1,a_2,....,a_m$) and ($b_1, b_2,....,b_n$) sequences with non-negative integers.

Decide whether it's possible and if it is construct a matrix $\Re^{m x n}$ of ones("1") and zeros("0") where the number of ones("1") in row $i$ is $\forall i$ : $a_i$ and in column $j$ is $\forall j$ : $b_j$

Any hint is greatly appreciated.

• If I understood, correctly, obviously not. Just let $m=2=n, a_1=3$. The number of $1$'s in row $1$ is supposed to be $3$, but the matrix is $2\times 2$, there isn't enough room in one row for three $1$'s. Apr 16, 2014 at 12:32
• Oh, wait, no sorry. The sequences are given. Updating question. Apr 16, 2014 at 12:36
• The problem still stands. We are given $(3,0)$ and $(0,0)$. The the number of $1$'s in row $1$ of a $2\times 2$ matrix is supposed to be $3$. Apr 16, 2014 at 12:39

• If they don't sum up to the same constant, then the answer is somewhat trivially no, because the sums of both sequences will be the total number of $1$'s in the matrix. Apr 16, 2014 at 12:49