Cody

# Problem 2063. A matrix of extroverts

Solution 1453398

Submitted on 1 Mar 2018 by Noriko HOUNOKI
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);

y = [] rt = [] temp = 4.2500 rt = 4.2500 temp = 4.7500 rt = 4.2500 4.7500 y = 4.2500 4.7500 temp = 5.2500 rt = 5.2500 temp = 5.7500 rt = 5.2500 5.7500 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);

y = [] rt = [] temp = 3 rt = 3 temp = 4 rt = 3 4 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);

y = [] rt = [] temp = 8.5000 rt = 8.5000 temp = 6.5000 rt = 8.5000 6.5000 temp = 8.5000 rt = 8.5000 6.5000 8.5000 temp = 0 rt = 8.5000 6.5000 8.5000 0 temp = -8.5000 rt = 8.5000 6.5000 8.5000 0 -8.5000 temp = -6.5000 rt = 8.5000 6.5000 8.5000 0 -8.5000 -6.5000 temp = -8.5000 rt = 8.5000 6.5000 8.5000 0 -8.5000 -6.5000 -8.5000 y = 8.5000 6.5000 8.5000 0 -8.5000 -6.5000 -8.5000 temp = 8 rt = 8 temp = 8.5000 rt = 8.0000 8.5000 temp = 9 rt = 8.0000 8.5000 9.0000 temp = 1.5000 rt = 8.0000 8.5000 9.0000 1.5000 temp = -8 rt = 8.0000 8.5000 9.0000 1.5000 -8.0000 temp = -8.5000 rt = 8.0000 8.5000 9.0000 1.5000 -8.0000 -8.5000 temp = -9 rt = 8.0000 8.5000 9.0000 1.5000 -8.0000 -8.5000 -9.0000 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 temp = 8.5000 rt = 8.5000 temp = 10.5000 rt = 8.5000 10.5000 temp = 8.5000 rt = 8.5000 10.5000 8.5000 temp = 0 rt = 8.5000 10.5000 8.5000 0 temp = -8.5000 rt = 8.5000 10.5000 8.5000 0 -8.5000 temp = -10.5000 rt = 8.5000 10.5000 8.5000 0 -8.5000 -10.5000 temp = -8.5000 rt = 8.5000 10.5000 8.5000 0 -8.5000 -10.5000 -8.5000 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 -8.5000

4   Pass
x = ones(20); y = extroverts(x); y_c = ones(19); assert(max(max(abs(y-y_c)))<1e-9);

y = [] rt = [] temp = 1 rt = 1 temp = 1 rt = 1 1 temp = 1 rt = 1 1 1 temp = 1 rt = 1 1 1 1 temp = 1 rt = 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 y = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 temp = 1 rt = 1 temp = 1 rt = 1 1 temp = 1 rt = 1 1 1 temp = 1 rt = 1 1 1 1 temp = 1 rt = 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 y = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 temp = 1 rt = 1 temp = 1 rt = 1 1 temp = 1 rt = 1 1 1 temp = 1 rt = 1 1 1 1 temp = 1 rt = 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 1 1 1 temp = 1 rt = 1 1 1 1 1 1 1 1 1 1 1 1 temp = 1 rt = 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