Cody

# Problem 44787. What can you get for exactly amount of money(harder)

Solution 1677760

Submitted on 21 Nov 2018
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
v = [ 195 125 260 440 395 290]; s = 570; tic res = buy(v, s); toc assert(sum(res) == s); assert(all(ismember(res, v)))

c = 3 1 0 0 0 0 Elapsed time is 0.003273 seconds.

Assertion failed.

2   Fail
v = [ 150 180 60 40]; s = 210; tic res = buy(v, s); toc assert(sum(res) == s); assert(all(ismember(res, v)))

c = 0 1 1 0 Elapsed time is 0.002476 seconds.

Assertion failed.

3   Fail
v = [ 150 180 60 40]; s = 1e10; tic res = buy(v, s); toc assert(sum(res) == s); assert(all(ismember(res, v)))

c = 250000000 0 0 0 Elapsed time is 0.000492 seconds.

Assertion failed.

4   Fail
v = [123456, 963852, 753159, 7841, 122]; s = 1e10+19; tic res = buy(v, s); toc assert(sum(res) == s); assert(all(ismember(res, v)))

c = 81967149 1 0 0 0 Elapsed time is 0.000554 seconds.

Assertion failed.

5   Fail
v = [319,2770,462,972,8235,6949,3171,9503,345,4388,3816,7656,7952,1869,4898,4456,6464,7094,7547,2761,6798,6551,1627,1190,4984,9598,3404,5853,2239,7513]; s = 1e10+19; tic; res = buy(v, s); toc; assert(sum(res) == s); assert(all(ismember(res, v)))

c = Columns 1 through 14 31347731 214 0 0 0 0 0 0 0 0 0 0 0 0 Columns 15 through 28 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 29 through 30 0 0 Elapsed time is 0.002986 seconds.

Assertion failed.

6   Fail
v = [3898,2417,4040,965,1320,9421,9562,5753,598,2348,3532,8212,155,431,1690,6492,7318,6478,4510,5471,2964,7447,1890,6868,1836,3685,6257,7803,812,9294,7758,4868,4359,4468,3064,5086,5108,8177,7949,6444,3787,8116,5329,3508,9391,8760,5502,6225,5871,2078]; s = 1e10+19; tic; res = buy(v, s); toc; assert(sum(res) == s); assert(all(ismember(res, v)))

c = Columns 1 through 14 64515979 54 0 0 0 0 0 0 0 0 0 0 0 0 Columns 15 through 28 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 29 through 42 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 43 through 50 0 0 0 0 0 0 0 0 Elapsed time is 0.000818 seconds.

Assertion failed.