Cody

# Problem 45416. Don't be Greedy!

Solution 2197736

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

Unable to perform assignment because the size of the left side is 1-by-3 and the size of the right side is 2-by-3. Error in greedy_01 (line 13) total(i,:)=s; 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

Unable to perform assignment because the size of the left side is 1-by-5 and the size of the right side is 2-by-5. Error in greedy_01 (line 13) total(i,:)=s; 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

Unable to perform assignment because the size of the left side is 1-by-4 and the size of the right side is 2-by-4. Error in greedy_01 (line 13) total(i,:)=s; 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

Unable to perform assignment because the size of the left side is 1-by-7 and the size of the right side is 2-by-7. Error in greedy_01 (line 13) total(i,:)=s; 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!