Binary matrix with specific sum for columns and rows

Does Elixir have an elegant way of filling up a binary matrix? Say for example, we have a 8X5 matrix and the sum of rows is 4(1st row),5,5,5,5(5th row) and sum of columns in 3. How can we fit in 24 1s and 16 0s into this to meet the above constraints?

We can use something like https://stackoverflow.com/questions/46249584/generate-a-2d-array-of-integers-from-given-sums-of-its-rows-and-columns

but is there a cleaner approach in Elixir?