Cody

Solution 407441

Submitted on 21 Feb 2014
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

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)));

Error: Undefined function or variable "dependencies_".

2   Fail
%% 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)));

Error: Undefined function or variable "dependencies_".

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)));

Error: Undefined function or variable "dependencies_".

4   Fail
%% 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));

Error: Undefined function or variable "dependencies_".

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));

Error: Undefined function or variable "dependencies_".

6   Fail
%% 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));

Error: Undefined function or variable "dependencies_".

7   Fail
%% dependencies_ = ones(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)))));

Error: Undefined function or variable "dependencies_".