Cody

# Problem 51. Find the two most distant points

Solution 163120

Submitted on 16 Nov 2012 by Claudia
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
%% p = [0 0; 1 0; 2 2; 0 1]; ix_correct = [1 3]; assert(isequal(mostDistant(p),ix_correct))

mat_dist = 0 mat_dist = 0 1 mat_dist = 0 1 4 mat_dist = 0 1 4 1 mat_dist = 0 1 4 1 1 0 0 0 mat_dist = 0 1 4 1 1 0 0 0 mat_dist = 0 1 4 1 1 0 3 0 mat_dist = 0 1 4 1 1 0 3 2 mat_dist = 0 1 4 1 1 0 3 2 4 0 0 0 mat_dist = 0 1 4 1 1 0 3 2 4 3 0 0 mat_dist = 0 1 4 1 1 0 3 2 4 3 0 0 mat_dist = 0 1 4 1 1 0 3 2 4 3 0 3 mat_dist = 0 1 4 1 1 0 3 2 4 3 0 3 1 0 0 0 mat_dist = 0 1 4 1 1 0 3 2 4 3 0 3 1 2 0 0 mat_dist = 0 1 4 1 1 0 3 2 4 3 0 3 1 2 3 0 mat_dist = 0 1 4 1 1 0 3 2 4 3 0 3 1 2 3 0

2   Pass
%% p = [0 0; 1 0; 2 2; 0 10]; ix_correct = [2 4]; assert(isequal(mostDistant(p),ix_correct))

mat_dist = 0 mat_dist = 0 1 mat_dist = 0 1 4 mat_dist = 0 1 4 10 mat_dist = 0 1 4 10 1 0 0 0 mat_dist = 0 1 4 10 1 0 0 0 mat_dist = 0 1 4 10 1 0 3 0 mat_dist = 0 1 4 10 1 0 3 11 mat_dist = 0 1 4 10 1 0 3 11 4 0 0 0 mat_dist = 0 1 4 10 1 0 3 11 4 3 0 0 mat_dist = 0 1 4 10 1 0 3 11 4 3 0 0 mat_dist = 0 1 4 10 1 0 3 11 4 3 0 10 mat_dist = 0 1 4 10 1 0 3 11 4 3 0 10 10 0 0 0 mat_dist = 0 1 4 10 1 0 3 11 4 3 0 10 10 11 0 0 mat_dist = 0 1 4 10 1 0 3 11 4 3 0 10 10 11 10 0 mat_dist = 0 1 4 10 1 0 3 11 4 3 0 10 10 11 10 0

3   Pass
%% p = [0 0; -1 50]; ix_correct = [1 2]; assert(isequal(mostDistant(p),ix_correct))

mat_dist = 0 mat_dist = 0 51 mat_dist = 0 51 51 0 mat_dist = 0 51 51 0

4   Pass
%% p = [5 5; 1 0; 2 2; 0 10; -100 20; 1000 400]; ix_correct = [5 6]; assert(isequal(mostDistant(p),ix_correct))

mat_dist = 0 mat_dist = 0 9 mat_dist = 0 9 6 mat_dist = 0 9 6 10 mat_dist = 0 9 6 10 120 mat_dist = 0 9 6 10 120 1390 mat_dist = 0 9 6 10 120 1390 9 0 0 0 0 0 mat_dist = 0 9 6 10 120 1390 9 0 0 0 0 0 mat_dist = 0 9 6 10 120 1390 9 0 3 0 0 0 mat_dist = 0 9 6 10 120 1390 9 0 3 11 0 0 mat_dist = 0 9 6 10 120 1390 9 0 3 11 121 0 mat_dist = 0 9 6 10 120 1390 9 0 3 11 121 1399 mat_dist = 0 9 6 10 120 1390 9 0 3 11 121 1399 6 0 0 0 0 0 mat_dist = 0 9 6 10 120 1390 9 0 3 11 121 1399 6 3 0 0 0 0 mat_dist = 0 9 6 10 120 1390 9 0 3 11 121 1399 6 3 0 0 0 0 mat_dist = 0 9 6 10 120 1390 9 0 3 11 121 1399 6 3 0 10 0 0 mat_dist = 0 9 6 10 120 1390 9 0 3 11 121 1399 6 3 0 10 120 0 mat_dist = 0 9 6 10 120 1390 9 0 3 11 121 1399 6 3 0 10 120 1396 mat_dist = 0 9 6 10 120 1390 9 0 3 11 121 1399 6 3 0 10 120 1396 10 0 0 0 0 0 mat_dist = 0 9 6 10 120 1390 9 0 3 11 121 1399 6 3 0 10 120 1396 10 11 0 0 0 0 mat_dist = 0 9 6 10 120 1390 9 0 3 11 121 1399 6 3 0 10 120 1396 10 11 10 0 0 0 mat_dist = 0 9 6 10 120 1390 9 0 3 11 121 1399 6 3 0 10 120 1396 10 11 10 0 0 0 mat_dist = 0 9 6 10 120 1390 9 0 3 11 121 1399 6 3 0 10 120 1396 10 11 10 0 110 0 mat_dist = 0 9 6 10 120 1390 9 0 3 11 121 1399 6 3 0 10 120 1396 10 11 10 0 110 1390 mat_dist = 0 9 6 10 120 1390 9 0 3 11 121 1399 6 3 0 10 120 1396 10 11 10 0 110 1390 120 0 0 0 0 0 mat_dist = 0 9 6 10 120 1390 9 0 3 11 121 1399 6 3 0 10 120 1396 10 11 10 0 110 1390 120 121 0 0 0 0 mat_dist = 0 9 6 10 120 1390 9 0 3 11 121 1399 6 3 0 10 120 1396 10 11 10 0 110 1390 120 121 120 0 0 0 mat_dist = 0 9 6 10 120 1390 9 0 3 11 121 1399 6 3 0 10 120 1396 10 11 10 0 110 1390 120 121 120 110 0 0 mat_dist = 0 9 6 10 120 1390 9 0 3 11 121 1399 6 3 0 10 120 1396 10 11 10 0 110 1390 120 121 120 110 0 0 mat_dist = 0 9 6 10 120 1390 9 0 3 11 121 1399 6 3 0 10 120 1396 10 11 10 0 110 1390 120 121 120 110 0 1480 mat_dist = 0 9 6 10 120 1390 9 0 3 11 121 1399 6 3 0 10 120 1396 10 11 10 0 110 1390 120 121 120 110 0 1480 1390 0 0 0 0 0 mat_dist = 0 9 6 10 120 1390 9 0 3 11 121 1399 6 3 0 10 120 1396 10 11 10 0 110 1390 120 121 120 110 0 1480 1390 1399 0 0 0 0 mat_dist = 0 9 6 10 120 1390 9 0 3 11 121 1399 6 3 0 10 120 1396 10 11 10 0 110 1390 120 121 120 110 0 1480 1390 1399 1396 0 0 0 mat_dist = 0 9 6 10 120 1390 9 0 3 11 121 1399 6 3 0 10 120 1396 10 11 10 0 110 1390 120 121 120 110 0 1480 1390 1399 1396 1390 0 0 mat_dist = 0 9 6 10 120 1390 9 0 3 11 121 1399 6 3 0 10 120 1396 10 11 10 0 110 1390 120 121 120 110 0 1480 1390 1399 1396 1390 1480 0 mat_dist = 0 9 6 10 120 1390 9 0 3 11 121 1399 6 3 0 10 120 1396 10 11 10 0 110 1390 120 121 120 110 0 1480 1390 1399 1396 1390 1480 0