Cody

Solution 2470727

Submitted on 4 Jun 2020 by Nikolaos Nikolaou
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
format compact c=cell(1,3); c{1}=2:6;c{2}=7:12;c{3}=13:18; a=[1 2 3];b=[4 5 6]; y_correct = [5 11 18]; assert(isequal(break_cells_down(c,a,b),y_correct))

y = [] t = 2 3 4 5 6 y = 5 t = 7 8 9 10 11 12 y = 5 11 t = 13 14 15 16 17 18 y = 5 11 18

2   Pass
clear c c=cell(1,5); c{1}=rand(1,10); c{2}=rand(1,10); c{3}=rand(1,10); c{4}=rand(1,10); c{5}=rand(1,10); a=randperm(5) b=randperm(10); b=b(1:5) y_correct=[c{a(1)}(b(1)) c{a(2)}(b(2)) c{a(3)}(b(3)) c{a(4)}(b(4)) c{a(5)}(b(5))] assert(isequal(break_cells_down(c,a,b),y_correct))

a = 5 4 1 2 3 b = 10 9 2 3 8 y_correct = 0.9070 0.2349 0.3978 0.6372 0.3149 y = [] t = 0.8954 0.7402 0.0746 0.9341 0.2070 0.2490 0.7312 0.1591 0.9682 0.9070 y = 0.9070 t = 0.1247 0.2875 0.8378 0.3356 0.8415 0.8518 0.9872 0.6867 0.2349 0.7127 y = 0.9070 0.2349 t = 0.2013 0.3978 0.8957 0.8951 0.7124 0.7724 0.9284 0.7576 0.6911 0.0522 y = 0.9070 0.2349 0.3978 t = 0.4045 0.0096 0.6372 0.1687 0.5977 0.7930 0.1925 0.3990 0.4742 0.2098 y = 0.9070 0.2349 0.3978 0.6372 t = 0.7784 0.2891 0.9384 0.5100 0.1877 0.6197 0.4034 0.3149 0.6819 0.9116 y = 0.9070 0.2349 0.3978 0.6372 0.3149

3   Pass
clear c c=cell(1,6); c{1}=1:6; c{2}=1:6; c{3}=1:6; c{4}=1:6; c{5}=1:6; c{6}=1:6; a=1:6; b=randperm(6) y_correct=b; assert(isequal(break_cells_down(c,a,b),y_correct))

b = 2 3 4 5 6 1 y = [] t = 1 2 3 4 5 6 y = 2 t = 1 2 3 4 5 6 y = 2 3 t = 1 2 3 4 5 6 y = 2 3 4 t = 1 2 3 4 5 6 y = 2 3 4 5 t = 1 2 3 4 5 6 y = 2 3 4 5 6 t = 1 2 3 4 5 6 y = 2 3 4 5 6 1