Cody

Problem 1286. MatCAT - Reconstruct X from Its X-rays

Solution 2880659

Submitted on 26 Aug 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
row_sums = [3 5 11]; col_sums = [4 7 8]; x = matcat(row_sums,col_sums); assert(all(x(:)>=0)) assert(isequal(floor(x),x)) assert(isequal(sum(x,2)',row_sums)) assert(isequal(sum(x,1),col_sums))

x = 3 no_unk = 9 unk = 0 0 0 0 0 0 0 0 0 unk = 1 0 0 0 0 0 0 0 0 unk = 1 0 0 2 0 0 0 0 0 unk = 1 0 0 2 0 0 3 0 0 unk = 1 4 0 2 0 0 3 0 0 unk = 1 4 0 2 5 0 3 0 0 unk = 1 4 0 2 5 0 3 6 0 unk = 1 4 7 2 5 0 3 6 0 unk = 1 4 7 2 5 8 3 6 0 unk = 1 4 7 2 5 8 3 6 9 matrix_unk = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 matrix_unk = 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 matrix_unk = 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 matrix_unk = 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 matrix_unk = 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 matrix_unk = 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 matrix_unk = 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 matrix_unk = 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0 0 matrix_unk = 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 0 matrix_unk = 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 1 b = 3 5 11 4 7 8 z = 0.2222 1.2222 1.5556 0.8889 1.8889 2.2222 2.8889 3.8889 4.2222 x = 0 1 2 1 2 2 3 4 4

2   Fail
row_sums = [2 2 2 2 2 6]; col_sums = [2 3 3 3 3 2]; x = matcat(row_sums,col_sums); assert(all(x(:)>=0)) assert(isequal(floor(x),x)) assert(isequal(sum(x,2)',row_sums)) assert(isequal(sum(x,1),col_sums))

x = 6 no_unk = 36 unk = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 unk = 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 unk = 1 0 0 0 0 0 2 0 0 0 0 0 0 0 0 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0 0 0 unk = 1 7 13 0 0 0 2 8 14 0 0 0 3 9 15 0 0 0 4 10 16 0 0 0 5 11 0 0 0 0 6 12 0 0 0 0 unk = 1 7 13 0 0 0 2 8 14 0 0 0 3 9 15 0 0 0 4 10 16 0 0 0 5 11 17 0 0 0 6 12 0 0 0 0 unk = 1 7 13 0 0 0 2 8 14 0 0 0 3 9 15 0 0 0 4 10 16 0 0 0 5 11 17 0 0 0 6 12 18 0 0 0 unk = 1 7 13 19 0 0 2 8 14 0 0 0 3 9 15 0 0 0 4 10 16 0 0 0 5 11 17 0 0 0 6 12 18 0 0 0 unk = 1 7 13 19 0 0 2 8 14 20 0 0 3 9 15 0 0 0 4 10 16 0 0 0 5 11 17 0 0 0 6 12 18 0 0 0 unk = 1 7 13 19 0 0 2 8 14 20 0 0 3 9 15 21 0 0 4 10 16 0 0 0 5 11 17 0 0 0 6 12 18 0 0 0 unk = 1 7 13 19 0 0 2 8 14 20 0 0 3 9 15 21 0 0 4 10 16 22 0 0 5 11 17 0 0 0 6 12 18 0 0 0 unk = 1 7 13 19 0 0 2 8 14 20 0 0 3 9 15 21 0 0 4 10 16 22 0 0 5 11 17 23 0 0 6 12 18 0 0 0 unk = 1 7 13 19 0 0 2 8 14 20 0 0 3 9 15 21 0 0 4 10 16 22 0 0 5 11 17 23 0 0 6 12 18 24 0 0 unk = 1 7 13 19 25 0 2 8 14 20 0 0 3 9 15 21 0 0 4 10 16 22 0 0 5 11 17 23 0 0 6 12 18 24 0 0 unk = 1 7 13 19 25 0 2 8 14 20 26 0 3 9 15 21 0 0 4 10 16 22 0 0 5 11 17 23 0 0 6 12 18 24 0 0 unk = 1 7 13 19 25 0 2 8 14 20 26 0 3 9 15 21 27 0 4 10 16 22 0 0 5 11 17 23 0 0 6 12 18 24 0 0 unk = 1 7 13 19 25 0 2 8 14 20 26 0 3 9 15 21 27 0 4 10 16 22 28 0 5 11 17 23 0 0 6 12 18 24 0 0 unk = 1 7 13 19 25 0 2 8 14 20 26 0 3 9 15 21 27 0 4 10 16 22 28 0 5 11 17 23 29 0 6 12 18 24 0 0 unk = 1 7 13 19 25 0 2 8 14 20 26 0 3 9 15 21 27 0 4 10 16 22 28 0 5 11 17 23 29 0 6 12 18 24 30 0 unk = 1 7 13 19 25 31 2 8 14 20 26 0 3 9 15 21 27 0 4 10 16 22 28 0 5 11 17 23 29 0 6 12 18 24 30 0 unk = 1 7 13 19 25 31 2 8 14 20 26 32 3 9 15 21 27 0 4 10 16 22 28 0 5 11 17 23 29 0 6 12 18 24 30 0 unk = 1 7 13 19 25 31 2 8 14 20 26 32 3 9 15 21 27 33 4 10 16 22 28 0 5 11 17 23 29 0 6 12 18 24 30 0 unk = 1 7 13 19 25 31 2 8 14 20 26 32 3 9 15 21 27 33 4 10 16 22 28 34 5 11 17 23 29 0 6 12 18 24 30 0 unk = 1 7 13 19 25 31 2 8 14 20 26 32 3 9 15 21 27 33 4 10 16 22 28 34 5 11 17 23 29 35 6 12 18 24 30 0 unk = 1 7 13 19 25 31 2 8 14 20 26 32 3 9 15 21 27 33 4 10 16 22 28 34 5 11 17 23 29 35 6 12 18 24 30 36 matrix_unk = Columns 1 through 30 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

Assertion failed.

3   Pass
row_sums = [65 65 65 65 65]; col_sums = [65 65 65 65 65]; x = matcat(row_sums,col_sums); assert(all(x(:)>=0)) assert(isequal(floor(x),x)) assert(isequal(sum(x,2)',row_sums)) assert(isequal(sum(x,1),col_sums))

x = 5 no_unk = 25 unk = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 unk = 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 unk = 1 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 unk = 1 0 0 0 0 2 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 unk = 1 0 0 0 0 2 0 0 0 0 3 0 0 0 0 4 0 0 0 0 0 0 0 0 0 unk = 1 0 0 0 0 2 0 0 0 0 3 0 0 0 0 4 0 0 0 0 5 0 0 0 0 unk = 1 6 0 0 0 2 0 0 0 0 3 0 0 0 0 4 0 0 0 0 5 0 0 0 0 unk = 1 6 0 0 0 2 7 0 0 0 3 0 0 0 0 4 0 0 0 0 5 0 0 0 0 unk = 1 6 0 0 0 2 7 0 0 0 3 8 0 0 0 4 0 0 0 0 5 0 0 0 0 unk = 1 6 0 0 0 2 7 0 0 0 3 8 0 0 0 4 9 0 0 0 5 0 0 0 0 unk = 1 6 0 0 0 2 7 0 0 0 3 8 0 0 0 4 9 0 0 0 5 10 0 0 0 unk = 1 6 11 0 0 2 7 0 0 0 3 8 0 0 0 4 9 0 0 0 5 10 0 0 0 unk = 1 6 11 0 0 2 7 12 0 0 3 8 0 0 0 4 9 0 0 0 5 10 0 0 0 unk = 1 6 11 0 0 2 7 12 0 0 3 8 13 0 0 4 9 0 0 0 5 10 0 0 0 unk = 1 6 11 0 0 2 7 12 0 0 3 8 13 0 0 4 9 14 0 0 5 10 0 0 0 unk = 1 6 11 0 0 2 7 12 0 0 3 8 13 0 0 4 9 14 0 0 5 10 15 0 0 unk = 1 6 11 16 0 2 7 12 0 0 3 8 13 0 0 4 9 14 0 0 5 10 15 0 0 unk = 1 6 11 16 0 2 7 12 17 0 3 8 13 0 0 4 9 14 0 0 5 10 15 0 0 unk = 1 6 11 16 0 2 7 12 17 0 3 8 13 18 0 4 9 14 0 0 5 10 15 0 0 unk = 1 6 11 16 0 2 7 12 17 0 3 8 13 18 0 4 9 14 19 0 5 10 15 0 0 unk = 1 6 11 16 0 2 7 12 17 0 3 8 13 18 0 4 9 14 19 0 5 10 15 20 0 unk = 1 6 11 16 21 2 7 12 17 0 3 8 13 18 0 4 9 14 19 0 5 10 15 20 0 unk = 1 6 11 16 21 2 7 12 17 22 3 8 13 18 0 4 9 14 19 0 5 10 15 20 0 unk = 1 6 11 16 21 2 7 12 17 22 3 8 13 18 23 4 9 14 19 0 5 10 15 20 0 unk = 1 6 11 16 21 2 7 12 17 22 3 8 13 18 23 4 9 14 19 24 5 10 15 20 0 unk = 1 6 11 16 21 2 7 12 17 22 3 8 13 18 23 4 9 14 19 24 5 10 15 20 25 matrix_unk = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 matrix_unk = 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

4   Fail
row_sums = [22 34 33]; col_sums = [15 23 18 21 12]; x = matcat(row_sums,col_sums); assert(all(x(:)>=0)) assert(isequal(floor(x),x)) assert(isequal(sum(x,2)',row_sums)) assert(isequal(sum(x,1),col_sums))

x = 3 no_unk = 9 unk = 0 0 0 0 0 0 0 0 0 unk = 1 0 0 0 0 0 0 0 0 unk = 1 0 0 2 0 0 0 0 0 unk = 1 0 0 2 0 0 3 0 0 unk = 1 4 0 2 0 0 3 0 0 unk = 1 4 0 2 5 0 3 0 0 unk = 1 4 0 2 5 0 3 6 0 unk = 1 4 7 2 5 0 3 6 0 unk = 1 4 7 2 5 8 3 6 0 unk = 1 4 7 2 5 8 3 6 9 matrix_unk = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 matrix_unk = 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 matrix_unk = 1 1 0 0 0 0 0 0 0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k = 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 matrix_unk = 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 matrix_unk = 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 matrix_unk = 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 matrix_unk = 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 matrix_unk = 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0 0 matrix_unk = 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 0 matrix_unk = 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 1 b = 22 34 33 15 23 18 21 12

Error using * Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To perform elementwise multiplication, use '.*'. Error in matcat (line 21) z=pinv(matrix_unk)*b Error in Test4 (line 3) x = matcat(row_sums,col_sums);

5   Fail
row_sums = 55; col_sums = [1 2 3 4 5 6 7 8 9 10]; x = matcat(row_sums,col_sums); assert(all(x(:)>=0)) assert(isequal(floor(x),x)) assert(isequal(sum(x,2)',row_sums)) assert(isequal(sum(x,1),col_sums))

x = 1 no_unk = 1 unk = 0 unk = 1 matrix_unk = 0 0 matrix_unk = 1 0 matrix_unk = 1 1 b = 55 1 2 3 4 5 6 7 8 9 10

Error using * Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To perform elementwise multiplication, use '.*'. Error in matcat (line 21) z=pinv(matrix_unk)*b Error in Test5 (line 3) x = matcat(row_sums,col_sums);

Suggested Problems

More from this Author50

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!