Cody

# Problem 45401. ZigZag - 02

Solution 2185364

Submitted on 31 Mar 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   Fail
a=[1,2,3,4,5; 6,7,8,9,1; 1,1,1,1,1]; y=[1,2,3,4,5,8,1,1,1,1,1]; assert(isequal(z_mat_02(a),y))

a = 1 2 3 4 5 6 7 8 9 1 1 1 1 1 1 ans = 1 4 7 10 13 16 19 22 3 6 9 12 15 18 21 24

Output argument "y" (and maybe others) not assigned during call to "z_mat_02". Error in Test1 (line 5) assert(isequal(z_mat_02(a),y))

2   Fail
a=reshape(1:24,3,[]); y=[1:3:22,3:3:24]; assert(isequal(z_mat_02(a),y))

a = 1 4 7 10 13 16 19 22 2 5 8 11 14 17 20 23 3 6 9 12 15 18 21 24 ans = 1 4 7 10 13 16 19 22 3 6 9 12 15 18 21 24

Output argument "y" (and maybe others) not assigned during call to "z_mat_02". Error in Test2 (line 3) assert(isequal(z_mat_02(a),y))

3   Fail
a=reshape(1:24,4,[]); y=[1:4:21,4:4:24]; assert(isequal(z_mat_02(a),y))

a = 1 5 9 13 17 21 2 6 10 14 18 22 3 7 11 15 19 23 4 8 12 16 20 24 ans = 1 4 7 10 13 16 19 22 3 6 9 12 15 18 21 24

Output argument "y" (and maybe others) not assigned during call to "z_mat_02". Error in Test3 (line 3) assert(isequal(z_mat_02(a),y))

4   Pass
a=reshape(30:65,12,[]) y=[ 30 42 54 41 53 65]; assert(isequal(z_mat_02(a),y))

a = 30 42 54 31 43 55 32 44 56 33 45 57 34 46 58 35 47 59 36 48 60 37 49 61 38 50 62 39 51 63 40 52 64 41 53 65 a = 30 42 54 31 43 55 32 44 56 33 45 57 34 46 58 35 47 59 36 48 60 37 49 61 38 50 62 39 51 63 40 52 64 41 53 65 ans = 1 4 7 10 13 16 19 22 3 6 9 12 15 18 21 24 y = 30 42 54 41 53 65

5   Fail
a=magic(5); y=[ 17 24 1 8 15 14 13 12 11 18 25 2 9]; assert(isequal(z_mat_02(a),y))

a = 17 24 1 8 15 23 5 7 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9 ans = 1 4 7 10 13 16 19 22 3 6 9 12 15 18 21 24

Output argument "y" (and maybe others) not assigned during call to "z_mat_02". Error in Test5 (line 3) assert(isequal(z_mat_02(a),y))

6   Fail
a=reshape(magic(9),3,[]); y=[47 77 26 58 7 28 69 18 39 80 20 50 1 31 61 12 42 72 23 53 74 34 55 4 45 66 15 41 67 16 37 78 27 48 8 29 59 10 40 70 21 51 81 32 62 2 43 64 13 54 75 24 56 5 35]; assert(isequal(z_mat_02(a),y))

a = 47 77 26 58 7 28 69 18 39 80 20 50 1 31 61 12 42 72 23 53 74 34 55 4 45 66 15 57 6 36 68 17 38 79 19 49 9 30 60 11 41 71 22 52 73 33 63 3 44 65 14 46 76 25 67 16 37 78 27 48 8 29 59 10 40 70 21 51 81 32 62 2 43 64 13 54 75 24 56 5 35 ans = 1 4 7 10 13 16 19 22 3 6 9 12 15 18 21 24

Output argument "y" (and maybe others) not assigned during call to "z_mat_02". Error in Test6 (line 3) assert(isequal(z_mat_02(a),y))

7   Fail
a=eye(5); aa=[a;a;a]; y=[ 1 0 0 0 0 1 0 0 0 0 1]; assert(isequal(z_mat_02(aa),y))

a = 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 ans = 1 4 7 10 13 16 19 22 3 6 9 12 15 18 21 24 y = 1 0 0 0 0 0 0 0 0 1

Assertion failed.