Cody

Solution 36350

Submitted on 10 Feb 2012 by Jean-Yves Tinevez
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))

n = 4 a = 0 0 0 0 1 1 1 1 2 2 2 2 0 0 0 0 b = 0 0 0 0 0 0 0 0 2 2 2 2 1 1 1 1 d = 0 1 8 1 1 0 5 2 8 5 0 5 1 2 5 0 m = 8 i = 3 j = 1 ix = 1 3

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

n = 4 a = 0 0 0 0 1 1 1 1 2 2 2 2 0 0 0 0 b = 0 0 0 0 0 0 0 0 2 2 2 2 10 10 10 10 d = 0 1 8 100 1 0 5 101 8 5 0 68 100 101 68 0 m = 101 i = 4 j = 2 ix = 2 4

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

n = 2 a = 0 0 -1 -1 b = 0 0 50 50 d = 0 2501 2501 0 m = 2501 i = 2 j = 1 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))

n = 6 a = Columns 1 through 5 5 5 5 5 5 1 1 1 1 1 2 2 2 2 2 0 0 0 0 0 -100 -100 -100 -100 -100 1000 1000 1000 1000 1000 Column 6 5 1 2 0 -100 1000 b = 5 5 5 5 5 5 0 0 0 0 0 0 2 2 2 2 2 2 10 10 10 10 10 10 20 20 20 20 20 20 400 400 400 400 400 400 d = Columns 1 through 5 0 41 18 50 11250 41 0 5 101 10601 18 5 0 68 10728 50 101 68 0 10100 11250 10601 10728 10100 0 1146050 1158001 1154408 1152100 1354400 Column 6 1146050 1158001 1154408 1152100 1354400 0 m = 1354400 i = 6 j = 5 ix = 5 6