Cody

Problem 3061. Mirror, mirror on the wall, who is fairest of them all?

Solution 677720

Submitted on 30 May 2015
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
%% A=[2 1 1 1 1;0 2 1 1 1;0 0 2 1 1;0 0 0 2 1;0 0 0 0 2]; assert(isequal(fairest_girl(A),1064));

2   Pass
%% A=[2 1;0 2]; assert(isequal(fairest_girl(A),1016));

3   Pass
%% assert(isequal(fairest_girl([2 1 0.5;0 2 0.5;0.5 0.5 2]),1016));

4   Fail
%% A=[2 1 1 1 1 1;0 2 1 1 1 1;0 0 2 1 1 1;0 0 0 2 0.5 0.5;0 0 0 0.5 2 0.5;0 0 0 0.5 0.5 2]; assert(isequal(fairest_girl(A),1080));

Assertion failed.

5   Pass
%% A=[2 0.5 1;0.5 2 0.5;0 0.5 2]; assert(isequal(fairest_girl(A),1016));

6   Pass
%% A=[2 1 1 1 1 1 1;0 2 1 1 1 1 1;0 0 2 1 1 1 1;0 0 0 2 0.5 0.5 1;0 0 0 0.5 2 0.5 1;0 0 0 0.5 0.5 2 1;0 0 0 0 0 0 2]; assert(isequal(fairest_girl(A),1096));

7   Fail
%% A=[2 1 1 1 1 1 0.5;0 2 1 1 1 1 0.5;0 0 2 1 1 1 0.5;0 0 0 2 0.5 0.5 0.5;0 0 0 0.5 2 0.5 0.5;0 0 0 0.5 0.5 2 0.5;0.5 0.5 0.5 0.5 0.5 0.5 2]; assert(isequal(fairest_girl(A),1080));

Assertion failed.