Cody

# Problem 2063. A matrix of extroverts

Solution 3010129

Submitted on 30 Sep 2020 by mohsen
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
x = magic(3); y = extroverts(x); y_c = [4.2500 4.7500 ; 5.2500 5.7500]; assert(max(max(abs(y-y_c)))<1e-9);

x1 = 8 1 3 5 y = 4.2500 x1 = 1 6 5 7 y = 4.2500 4.7500 x1 = 3 5 4 9 y = 4.2500 4.7500 5.2500 0 x1 = 5 7 9 2 y = 4.2500 4.7500 5.2500 5.7500

2   Pass
x = [1 2 3 ; 4 5 6]; y = extroverts(x); y_c = [3 4]; assert(max(max(abs(y-y_c)))<1e-9);

x1 = 1 2 4 5 y = 3 x1 = 2 3 5 6 y = 3 4

3   Pass
x=[magic(4) -magic(4)]; y = extroverts(x); y_c=[8.5 6.5 8.5 0 -8.5 -6.5 -8.5 8 8.5 9 1.5 -8 -8.5 -9 8.5 10.5 8.5 0 -8.5 -10.5 -8.5]; assert(max(max(abs(y-y_c)))<1e-9);

x1 = 16 2 5 11 y = 8.5000 x1 = 2 3 11 10 y = 8.5000 6.5000 x1 = 3 13 10 8 y = 8.5000 6.5000 8.5000 x1 = 13 -16 8 -5 y = 8.5000 6.5000 8.5000 0 x1 = -16 -2 -5 -11 y = 8.5000 6.5000 8.5000 0 -8.5000 x1 = -2 -3 -11 -10 y = 8.5000 6.5000 8.5000 0 -8.5000 -6.5000 x1 = -3 -13 -10 -8 y = 8.5000 6.5000 8.5000 0 -8.5000 -6.5000 -8.5000 x1 = 5 11 9 7 y = 8.5000 6.5000 8.5000 0 -8.5000 -6.5000 -8.5000 8.0000 0 0 0 0 0 0 x1 = 11 10 7 6 y = 8.5000 6.5000 8.5000 0 -8.5000 -6.5000 -8.5000 8.0000 8.5000 0 0 0 0 0 x1 = 10 8 6 12 y = 8.5000 6.5000 8.5000 0 -8.5000 -6.5000 -8.5000 8.0000 8.5000 9.0000 0 0 0 0 x1 = 8 -5 12 -9 y = 8.5000 6.5000 8.5000 0 -8.5000 -6.5000 -8.5000 8.0000 8.5000 9.0000 1.5000 0 0 0 x1 = -5 -11 -9 -7 y = 8.5000 6.5000 8.5000 0 -8.5000 -6.5000 -8.5000 8.0000 8.5000 9.0000 1.5000 -8.0000 0 0 x1 = -11 -10 -7 -6 y = 8.5000 6.5000 8.5000 0 -8.5000 -6.5000 -8.5000 8.0000 8.5000 9.0000 1.5000 -8.0000 -8.5000 0 x1 = -10 -8 -6 -12 y = 8.5000 6.5000 8.5000 0 -8.5000 -6.5000 -8.5000 8.0000 8.5000 9.0000 1.5000 -8.0000 -8.5000 -9.0000 x1 = 9 7 4 14 y = 8.5000 6.5000 8.5000 0 -8.5000 -6.5000 -8.5000 8.0000 8.5000 9.0000 1.5000 -8.0000 -8.5000 -9.0000 8.5000 0 0 0 0 0 0 x1 = 7 6 14 15 y = 8.5000 6.5000 8.5000 0 -8.5000 -6.5000 -8.5000 8.0000 8.5000 9.0000 1.5000 -8.0000 -8.5000 -9.0000 8.5000 10.5000 0 0 0 0 0 x1 = 6 12 15 1 y = 8.5000 6.5000 8.5000 0 -8.5000 -6.5000 -8.5000 8.0000 8.5000 9.0000 1.5000 -8.0000 -8.5000 -9.0000 8.5000 10.5000 8.5000 0 0 0 0 x1 = 12 -9 1 -4 y = 8.5000 6.5000 8.5000 0 -8.5000 -6.5000 -8.5000 8.0000 8.5000 9.0000 1.5000 -8.0000 -8.5000 -9.0000 8.5000 10.5000 8.5000 0 0 0 0 x1 = -9 -7 -4 -14 y = 8.5000 6.5000 8.5000 0 -8.5000 -6.5000 -8.5000 8.0000 8.5000 9.0000 1.5000 -8.0000 -8.5000 -9.0000 8.5000 10.5000 8.5000 0 -8.5000 0 0 x1 = -7 -6 -14 -15 y = 8.5000 6.5000 8.5000 0 -8.5000 -6.5000 -8.5000 8.0000 8.5000 9.0000 1.5000 -8.0000 -8.5000 -9.0000 8.5000 10.5000 8.5000 0 -8.5000 -10.5000 0 x1 = -6 -12 -15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