Cody

# Problem 51. Find the two most distant points

Solution 113167

Submitted on 16 Jul 2012 by Nigel Davies
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))

m = 0 v = -1 0 n = 1 m = 1 ix = 1 2 v = -2 -2 n = 8 m = 8 ix = 1 3 v = 0 -1 n = 1 v = -1 -2 n = 5 v = 1 -1 n = 2 v = 2 1 n = 5

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

m = 0 v = -1 0 n = 1 m = 1 ix = 1 2 v = -2 -2 n = 8 m = 8 ix = 1 3 v = 0 -10 n = 100 m = 100 ix = 1 4 v = -1 -2 n = 5 v = 1 -10 n = 101 m = 101 ix = 2 4 v = 2 -8 n = 68

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

m = 0 v = 1 -50 n = 2501 m = 2501 ix = 1 2

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))

m = 0 v = 4 5 n = 41 m = 41 ix = 1 2 v = 3 3 n = 18 v = 5 -5 n = 50 m = 50 ix = 1 4 v = 105 -15 n = 11250 m = 11250 ix = 1 5 v = -995 -395 n = 1146050 m = 1146050 ix = 1 6 v = -1 -2 n = 5 v = 1 -10 n = 101 v = 101 -20 n = 10601 v = -999 -400 n = 1158001 m = 1158001 ix = 2 6 v = 2 -8 n = 68 v = 102 -18 n = 10728 v = -998 -398 n = 1154408 v = 100 -10 n = 10100 v = -1000 -390 n = 1152100 v = -1100 -380 n = 1354400 m = 1354400 ix = 5 6