Cody

# Problem 2191. Order of things - 3

Solution 788118

Submitted on 4 Dec 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   Fail
%% dependencies = [ 0 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 ]; groups = [ 3 3 1 2 1 ]; order = calculation_order(dependencies,groups); order_correct = [ 5 3 4 2 1 5 3 4 1 2 4 3 5 2 1 4 3 5 1 2 ]; assert(isequal(sortrows(order_correct),sortrows(order)));

Assertion failed.

2   Pass
%% dependencies = [ 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 ]; groups = [ 2 2 2 1 2 ]; order = calculation_order(dependencies,groups); order_correct = [ 4 3 2 1 5 ]; assert(isequal(sortrows(order_correct),sortrows(order)));

3   Fail
%% dependencies = [ 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 0 ]; groups = [ 1 1 2 3 2 ]; order = calculation_order(dependencies,groups); order_correct = [ 2 1 3 5 4 4 3 1 5 2 ]; assert(isequal(sortrows(order_correct),sortrows(order)));

Assertion failed.

4   Pass
%% dependencies = [ 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 ]; groups = [ 5 1 2 3 4 ]; order = calculation_order(dependencies,groups); assert(isempty(order));

5   Fail
%% dependencies = [ 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 0 0 ]; groups = [ 1 1 2 3 2 ]; order = calculation_order(dependencies,groups); assert(isempty(order));

Assertion failed.

6   Pass
%% dependencies = [ 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 ]; groups = [ 2 2 3 1 1 ]; order = calculation_order(dependencies,groups); assert(isempty(order));

7   Fail
%% dependencies_ = ones(10+randi(10)); dependencies_ = dependencies_-triu(dependencies_); order_ = randperm(size(dependencies_,1)); dependencies = dependencies_(order_,order_); order_ = 0; order = calculation_order(dependencies,1:size(dependencies_,1)); ordered = dependencies(order,order); assert(~nnz(triu(ordered-diag(diag(ordered))))); order = calculation_order(dependencies,ones(1,size(dependencies_,1))); ordered = dependencies(order,order); assert(~nnz(triu(ordered-diag(diag(ordered)))));

Maximum variable size allowed by the program is exceeded.