Cody

# Problem 51. Find the two most distant points

Solution 411546

Submitted on 1 Mar 2014 by Abdullah Caliskan
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))

A = (2,1) 1 (3,1) 8 (4,1) 1 (1,2) 1 (3,2) 5 (4,2) 2 (1,3) 8 (2,3) 5 (4,3) 5 (1,4) 1 (2,4) 2 (3,4) 5 K = (1,1) 8 k = 3 1 p = 1 3 a = 1 3

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

A = (2,1) 1 (3,1) 8 (4,1) 100 (1,2) 1 (3,2) 5 (4,2) 101 (1,3) 8 (2,3) 5 (4,3) 68 (1,4) 100 (2,4) 101 (3,4) 68 K = (1,1) 101 k = 4 2 p = 2 4 a = 2 4

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

A = (2,1) 2501 (1,2) 2501 K = (1,1) 2501 k = 2 1 p = 1 2 a = 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))

A = (2,1) 41 (3,1) 18 (4,1) 50 (5,1) 11250 (6,1) 1146050 (1,2) 41 (3,2) 5 (4,2) 101 (5,2) 10601 (6,2) 1158001 (1,3) 18 (2,3) 5 (4,3) 68 (5,3) 10728 (6,3) 1154408 (1,4) 50 (2,4) 101 (3,4) 68 (5,4) 10100 (6,4) 1152100 (1,5) 11250 (2,5) 10601 (3,5) 10728 (4,5) 10100 (6,5) 1354400 (1,6) 1146050 (2,6) 1158001 (3,6) 1154408 (4,6) 1152100 (5,6) 1354400 K = (1,1) 1354400 k = 6 5 p = 5 6 a = 5 6