Cody

# Problem 1684. Identify Reachable Points

Solution 1935636

Submitted on 14 Sep 2019 at 9:10
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
Pts=[5 5; 7 9]; dxy=[0 1]; Mxy=unique(Knights(Pts,dxy),'rows'); Mxy_exp =[4 5;5 4;5 6;6 5;6 9;7 8;7 10;8 9]; assert(isequal(Mxy,Mxy_exp))

ans = 5 5 5 4 5 6 5 4 5 6 4 6

Output argument "Mxy" (and maybe others) not assigned during call to "Knights". Error in Test1 (line 3) Mxy=unique(Knights(Pts,dxy),'rows');

2   Fail
Pts=[5 5]; dxy=[0 1;1 2]; Mxy=unique(Knights(Pts,dxy),'rows'); Mxy_exp =[3 4;3 6;4 3;4 5;4 7;5 4;5 6;6 3;6 5;6 7;7 4;7 6]; assert(isequal(Mxy,Mxy_exp))

ans = 5 5 5 4 5 6 5 4 5 6 4 6

Output argument "Mxy" (and maybe others) not assigned during call to "Knights". Error in Test2 (line 3) Mxy=unique(Knights(Pts,dxy),'rows');

3   Fail
pts=randi(20,6,2); dxy=randi(6,4,2); Mxy=unique(Knights(pts,dxy),'rows'); nP=size(pts,1); ndxy=size(dxy,1); mxy=[]; for i=1:nP mxy=[mxy; dxy(:,1)+pts(i,1) dxy(:,2)+pts(i,2); -dxy(:,1)+pts(i,1) dxy(:,2)+pts(i,2); dxy(:,1)+pts(i,1) -dxy(:,2)+pts(i,2); -dxy(:,1)+pts(i,1) -dxy(:,2)+pts(i,2); dxy(:,2)+pts(i,1) dxy(:,1)+pts(i,2); -dxy(:,2)+pts(i,1) dxy(:,1)+pts(i,2); dxy(:,2)+pts(i,1) -dxy(:,1)+pts(i,2); -dxy(:,2)+pts(i,1) -dxy(:,1)+pts(i,2)]; end Mxy_exp=unique(mxy,'rows'); assert(isequal(Mxy,Mxy_exp))

ans = 5 5 5 4 5 6 5 4 5 6 4 6

Output argument "Mxy" (and maybe others) not assigned during call to "Knights". Error in Test3 (line 3) Mxy=unique(Knights(pts,dxy),'rows');