Cody

Solution 1115285

Submitted on 3 Feb 2017 by Jean-Marie Sainthillier
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 long format compact seed=clock; seed=1000*seed(6); rng(seed) n=4; % Create a Unique element square array M=randperm(n*n); M=reshape(M,n,n) vr=M(1:n,:); vr=sortrows(vr); vc=M(:,1:n); vc=sortrows(vc')'; tic M_out=Criss_Cross(vr,vc); toc M_out assert(isequal(M,M_out));

M = 3 15 1 11 2 4 10 9 14 7 6 12 16 13 8 5 Elapsed time is 0.004152 seconds. M_out = 3 15 1 11 2 4 10 9 14 7 6 12 16 13 8 5

2   Pass
seed=clock; seed=1000*seed(6); rng(seed) n=8; % Create a Unique element square array M=randperm(n*n); M=reshape(M,n,n) vr=M(1:n,:); vr=sortrows(vr); vc=M(:,1:n); vc=sortrows(vc')'; tic M_out=Criss_Cross(vr,vc); toc M_out assert(isequal(M,M_out));

M = 33 45 41 8 18 3 39 53 51 43 19 40 30 12 64 25 21 37 50 52 4 58 26 32 57 27 29 9 62 44 60 14 49 10 22 5 20 42 61 38 24 35 47 17 2 23 16 34 46 36 1 31 48 7 11 28 13 55 59 63 54 56 6 15 Elapsed time is 0.001013 seconds. M_out = 33 45 41 8 18 3 39 53 51 43 19 40 30 12 64 25 21 37 50 52 4 58 26 32 57 27 29 9 62 44 60 14 49 10 22 5 20 42 61 38 24 35 47 17 2 23 16 34 46 36 1 31 48 7 11 28 13 55 59 63 54 56 6 15

3   Pass
seed=clock; seed=1000*seed(6); rng(seed) n=128; % Create a Unique element square array M=randperm(n*n); M=reshape(M,n,n); vr=M(1:n,:); vr=sortrows(vr); vc=M(:,1:n); vc=sortrows(vc')'; tic M_out=Criss_Cross(vr,vc); toc assert(isequal(M,M_out));

Elapsed time is 0.002123 seconds.

4   Pass
seed=clock; seed=1000*seed(6); rng(seed) n=1024; % Create a Unique element square array M=randperm(n*n); M=reshape(M,n,n); vr=M(1:n,:); vr=sortrows(vr); vc=M(:,1:n); vc=sortrows(vc')'; tic M_out=Criss_Cross(vr,vc); toc assert(isequal(M,M_out));

Elapsed time is 0.027917 seconds.

5   Pass
seed=clock; seed=1000*seed(6); rng(seed) n=4096; % Create a Unique element square array M=randperm(n*n); M=reshape(M,n,n); vr=M(1:n,:); vr=sortrows(vr); vc=M(:,1:n); vc=sortrows(vc')'; tic M_out=Criss_Cross(vr,vc); toc assert(isequal(M,M_out));

Elapsed time is 0.574889 seconds.