Cody

Problem 534. Find best domino orientation

Solution 1235140

Submitted on 20 Jul 2017 by Augusto Mazzei
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
list = [5 2 3 7 4 9 2 3 8 2 3 5 8 2 7 8 4 2 8 2]; y_correct = [0 0 1 1 1 1 1 1 0 1]; assert(isequal(findBestDominoeOrientation(list),y_correct))

g = 3 1 4 3 5 7 1 5 6 1 2 3 6 5 1 4 2 6 6 PX = 35 oriX = 0 0 0 0 0 0 0 0 0 0 PX = 29 oriX = 0 0 0 0 0 0 0 0 0 1 PX = 25 oriX = 0 0 0 0 0 0 1 0 0 1 PX = 23 oriX = 0 0 0 0 0 0 1 1 0 1 PX = 21 oriX = 0 0 0 0 1 1 1 0 0 1 PX = 19 oriX = 0 0 0 0 1 1 1 1 0 1 PX = 17 oriX = 0 0 0 1 1 1 1 1 0 1 PX = 15 oriX = 0 0 1 0 1 1 1 0 0 1 PX = 13 oriX = 0 0 1 0 1 1 1 1 0 1 PX = 11 oriX = 0 0 1 1 1 1 1 1 0 1

2   Pass
list = [0 8 4 8 2 0 8 0 5 7 7 2 1 6 2 6 2 7 0 2]; y_correct = [0 1 0 1 1 1 1 0 1 1]; assert(isequal(findBestDominoeOrientation(list),y_correct))

g = 8 4 4 6 2 8 8 5 2 0 5 1 5 4 4 4 5 7 2 PX = 39 oriX = 0 0 0 0 0 0 0 0 0 0 PX = 37 oriX = 0 0 0 0 0 0 0 0 0 1 PX = 31 oriX = 0 0 0 0 0 0 0 0 1 0 PX = 29 oriX = 0 0 0 0 0 0 0 0 1 1 PX = 27 oriX = 0 0 0 1 0 0 0 0 0 1 PX = 21 oriX = 0 0 0 1 0 0 0 0 1 0 PX = 19 oriX = 0 0 0 1 0 0 0 0 1 1 PX = 17 oriX = 0 0 0 1 1 1 1 0 1 1 PX = 13 oriX = 0 1 0 1 0 0 0 0 1 0 PX = 11 oriX = 0 1 0 1 0 0 0 0 1 1 PX = 9 oriX = 0 1 0 1 1 1 1 0 1 1

3   Pass
list = [7 5 3 1 5 1 6 5 4 8 2 6 5 1 1 3 5 9 9 2 0 7 1 7]; y_correct = [0 0 1 1 1 0 0 0 0 0 0 1]; assert(isequal(findBestDominoeOrientation(list),y_correct))

g = 2 2 2 4 4 5 1 1 4 6 4 1 4 0 2 2 4 0 7 2 7 6 6 PX = 29 oriX = 0 0 0 0 0 0 0 0 0 0 0 0 PX = 23 oriX = 0 0 0 0 0 0 0 0 0 0 0 1 PX = 21 oriX = 0 0 0 0 0 1 0 0 0 0 0 1 PX = 19 oriX = 0 0 0 1 1 0 0 0 0 0 0 1 PX = 15 oriX = 0 0 1 0 0 0 0 0 0 0 0 1 PX = 13 oriX = 0 0 1 0 0 1 0 0 0 0 0 1 PX = 11 oriX = 0 0 1 1 1 0 0 0 0 0 0 1

4   Pass
list = [0 4 0 3 8 2 2 5]; y_correct = [1 0 1 1]; assert(isequal(findBestDominoeOrientation(list),y_correct))

g = 4 4 3 5 6 0 3 PX = 9 oriX = 0 0 0 0 PX = 8 oriX = 0 0 1 1 PX = 6 oriX = 0 1 1 1 PX = 5 oriX = 1 0 0 0 PX = 4 oriX = 1 0 1 1