Cody

Problem 45395. Create a matrix map of increasing safety levels

Solution 3383343

Submitted on 26 Oct 2020 by cokakola
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
y_correct = [3 2 2 2 3 4; 3 2 1 2 3 4; ... 3 2 2 2 3 4; 3 3 3 3 3 4; 4 4 4 4 4 4; ... 5 5 5 5 5 5]; assert(isequal(safety_map(6,2,3),y_correct))

2   Pass
y_correct = [2 2;2 1]; assert(isequal(safety_map(2,2,2),y_correct))

3   Pass
y_correct = [9 8 7 6 5 4 3 2 1 2; ... 9 8 7 6 5 4 3 2 2 2; 9 8 7 6 5 4 3 3 3 3; ... 9 8 7 6 5 4 4 4 4 4; 9 8 7 6 5 5 5 5 5 5; ... 9 8 7 6 6 6 6 6 6 6; 9 8 7 7 7 7 7 7 7 7; ... 9 8 8 8 8 8 8 8 8 8; 9 9 9 9 9 9 9 9 9 9; ... 10 10 10 10 10 10 10 10 10 10]; assert(isequal(safety_map(10,1,9),y_correct))

4   Pass
y_correct = 1; assert(isequal(safety_map(1,1,1),y_correct))

5   Pass
y_correct = [4 3 2 2; ... 4 3 2 1; 4 3 2 2; 4 3 3 3]; assert(isequal(safety_map(4,2,4),y_correct))

6   Pass
y_correct = [2 1;2 2]; assert(isequal(safety_map(2,1,2),y_correct))

7   Pass
y_correct = [4 4 4 4 4 4 4; 4 3 3 3 3 3 4; ... 4 3 2 2 2 3 4; 4 3 2 1 2 3 4; 4 3 2 2 2 3 4; ... 4 3 3 3 3 3 4; 4 4 4 4 4 4 4]; assert(isequal(safety_map(7,4,4),y_correct))

8   Pass
y_correct = [10 10 10 10 10 10 10 10 10 10; ... 10 9 9 9 9 9 9 9 9 9; 10 9 8 8 8 8 8 8 8 8; ... 10 9 8 7 7 7 7 7 7 7; 10 9 8 7 6 6 6 6 6 6; ... 10 9 8 7 6 5 5 5 5 5; 10 9 8 7 6 5 4 4 4 4; ... 10 9 8 7 6 5 4 3 3 3; 10 9 8 7 6 5 4 3 2 2; ... 10 9 8 7 6 5 4 3 2 1]; assert(isequal(safety_map(10,10,10),y_correct))

9   Pass
y_correct = [3 3 3; 2 2 3; 1 2 3]; assert(isequal(safety_map(3,3,1),y_correct))

10   Pass
y_correct = [2 1 2; 2 2 2; 3 3 3]; assert(isequal(safety_map(3,1,2),y_correct))