Cody

# Problem 45416. Don't be Greedy!

Solution 2197740

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 ans = 20 2 ans = 60 40 0 1 ans = 100 20 0 0

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 ans = 100 4 ans = 30 0 0 0 0 3 ans = 50 40 10 0 0 2 ans = 10 0 0 0 0 1 ans = 10 20 0 0 0 0

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 ans = 10 3 ans = 0 0 0 0 2 ans = 50 40 0 0 1 ans = 100 80 200 220 0

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 ans = 150 6 ans = 80 10 0 0 0 0 0 5 ans = 0 0 0 0 0 0 0 4 ans = 0 0 0 0 0 0 0 3 ans = 40 0 0 0 0 0 0 2 ans = 50 200 220 0 0 0 0 1 ans = 100 0 0 0 0 0 0 0

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

### Community Treasure Hunt

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

Start Hunting!