Cody

Solution 1330563

Submitted on 7 Nov 2017 by Leo Nunnink
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
a = [1 0 0; 0 0 1; 0 0 0]; tf_correct = true; assert(isequal(queens(a),tf_correct))

x = 1 0 1 y = 1 1 0 z = 1 1 w = 1 1 f = logical 0 tf = logical 1

2   Pass
a = [0 0 0 1; 1 0 0 0; 0 0 1 0; 0 1 0 0]; tf_correct = false; assert(isequal(queens(a),tf_correct))

x = 1 1 1 1 y = 1 1 1 1 z = 1 1 1 1 w = 2 1 1 f = logical 1 tf = logical 0

3   Pass
a = [1 0 0 0 0; 0 0 0 1 1]; tf_correct = false; assert(isequal(queens(a),tf_correct))

x = 1 0 0 1 1 y = 1 2 z = 1 1 1 w = 1 1 1 f = logical 1 tf = logical 0

4   Pass
a = [ ... 0 0 1 0 0 0 0 0; 0 0 0 0 0 0 1 0; 0 1 0 0 0 0 0 0; 0 0 0 0 0 0 0 1; 0 0 0 0 0 1 0 0; 0 0 0 1 0 0 0 0; 1 0 0 0 0 0 0 0; 0 0 0 0 1 0 0 0]; tf_correct = true; assert(isequal(queens(a),tf_correct))

x = 1 1 1 1 1 1 1 1 y = 1 1 1 1 1 1 1 1 z = 1 1 1 1 1 1 1 1 w = 1 1 1 1 1 1 1 1 f = logical 0 tf = logical 1

5   Pass
a = ones(15,7); tf_correct = false; assert(isequal(queens(a),tf_correct))

x = 15 15 15 15 15 15 15 y = 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 z = 1 2 3 4 5 6 7 7 7 7 7 7 7 7 7 6 5 4 3 2 1 w = 1 2 3 4 5 6 7 7 7 7 7 7 7 7 7 6 5 4 3 2 1 f = logical 1 tf = logical 0

6   Pass
a = zeros(20,23); a(1,22) = 1; a(2,23) = 1; tf_correct = false; assert(isequal(queens(a),tf_correct))

x = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 y = 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 z = 2 w = 1 1 f = logical 1 tf = logical 0

7   Pass
a = [1 0; 0 1]; tf_correct = false; assert(isequal(queens(a),tf_correct))

x = 1 1 y = 1 1 z = 2 w = 1 1 f = logical 1 tf = logical 0

8   Pass
a = [1 0 1; 0 0 0; 0 1 0]; tf_correct = false; assert(isequal(queens(a),tf_correct))

x = 1 1 1 y = 2 0 1 z = 1 1 1 w = 1 1 1 f = logical 1 tf = logical 0