Cody

Solution 1669313

Submitted on 8 Nov 2018 by Oleksandr Denysenko
  • Size: 35
  • This is the leading solution.
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
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)));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In calculation_order (line 5) In ScoringEngineTestPoint1 (line 9) In solutionTest (line 3)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In calculation_order (line 3) In ScoringEngineTestPoint2 (line 9) In solutionTest (line 5)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In calculation_order (line 3) In ScoringEngineTestPoint3 (line 9) In solutionTest (line 7)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In calculation_order (line 3) In ScoringEngineTestPoint4 (line 9) In solutionTest (line 9)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In calculation_order (line 3) In ScoringEngineTestPoint5 (line 9) In solutionTest (line 11)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In calculation_order (line 3) In ScoringEngineTestPoint6 (line 9) In solutionTest (line 13)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In calculation_order (line 3) In ScoringEngineTestPoint7 (line 6) In solutionTest (line 15)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In calculation_order (line 3) In ScoringEngineTestPoint7 (line 9) In solutionTest (line 15)]