Cody

Problem 45416. Don't be Greedy!

Solution 2197752

Submitted on 7 Apr 2020
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
marks = [ 60,100, 20, 40, 20, 10] deadline = [ 2, 1, 3, 2, 1, 3] assert(isequal(greedy_01(marks,deadline),[2,1,3]))

marks = 60 100 20 40 20 10 deadline = 2 1 3 2 1 3 funds = 20 60 100

Output argument "yy" (and maybe others) not assigned during call to "greedy_01". Error in Test1 (line 3) assert(isequal(greedy_01(marks,deadline),[2,1,3]))

2   Fail
marks = [10,10,50,40,30,100,20,10] deadline = [1,2,3,3,5,5,1,3] assert(isequal(greedy_01(marks,deadline),[7,4,3,5,6]))

marks = 10 10 50 40 30 100 20 10 deadline = 1 2 3 3 5 5 1 3 funds = 100 30 50 40 20

Output argument "yy" (and maybe others) not assigned during call to "greedy_01". Error in Test2 (line 3) assert(isequal(greedy_01(marks,deadline),[7,4,3,5,6]))

3   Fail
marks = [50,100,40,80,200,220,10] deadline = [2,1,2,1,1,1,4] assert(isequal(greedy_01(marks,deadline),[6,1,7]))

marks = 50 100 40 80 200 220 10 deadline = 2 1 2 1 1 1 4 funds = 10 0 50 220

Output argument "yy" (and maybe others) not assigned during call to "greedy_01". Error in Test3 (line 3) assert(isequal(greedy_01(marks,deadline),[6,1,7]))

4   Fail
marks = [50,100,40,80,200,220,10,150] deadline = [2,1,3,6,2,2,6,7] assert(isequal(greedy_01(marks,deadline),[5 6 3 7 4 8]))

marks = 50 100 40 80 200 220 10 150 deadline = 2 1 3 6 2 2 6 7 funds = 150 80 10 0 40 220 200

Output argument "yy" (and maybe others) not assigned during call to "greedy_01". Error in Test4 (line 3) assert(isequal(greedy_01(marks,deadline),[5 6 3 7 4 8]))

Suggested Problems

More from this Author149

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!