Cody

Solution 2279976

Submitted on 14 May 2020 by Marc Winter
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
assert(isequal(decimate(10,3),4))

Elapsed time is 0.000529 seconds. Elapsed time is 0.000793 seconds. Elapsed time is 0.000383 seconds. Elapsed time is 0.000155 seconds. Elapsed time is 0.002521 seconds. Elapsed time is 0.004004 seconds. survivor = 4

2   Pass
assert(isequal(decimate(1024,3),676))

Elapsed time is 0.001231 seconds. Elapsed time is 0.000817 seconds. Elapsed time is 0.000262 seconds. Elapsed time is 0.000297 seconds. Elapsed time is 0.000144 seconds. Elapsed time is 0.000050 seconds. Elapsed time is 0.000015 seconds. Elapsed time is 0.000009 seconds. Elapsed time is 0.000043 seconds. Elapsed time is 0.000068 seconds. Elapsed time is 0.000009 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000036 seconds. Elapsed time is 0.000015 seconds. Elapsed time is 0.000125 seconds. Elapsed time is 0.000262 seconds. Elapsed time is 0.000537 seconds. Elapsed time is 0.001102 seconds. survivor = 676

3   Pass
assert(isequal(decimate(2012,50),543))

Elapsed time is 0.000647 seconds. Elapsed time is 0.000138 seconds. Elapsed time is 0.000130 seconds. Elapsed time is 0.000122 seconds. Elapsed time is 0.000136 seconds. Elapsed time is 0.000130 seconds. Elapsed time is 0.000112 seconds. Elapsed time is 0.000105 seconds. Elapsed time is 0.000101 seconds. Elapsed time is 0.000100 seconds. Elapsed time is 0.000179 seconds. Elapsed time is 0.000092 seconds. Elapsed time is 0.000100 seconds. Elapsed time is 0.000088 seconds. Elapsed time is 0.000083 seconds. Elapsed time is 0.000078 seconds. Elapsed time is 0.000078 seconds. Elapsed time is 0.000108 seconds. Elapsed time is 0.000073 seconds. Elapsed time is 0.000070 seconds. Elapsed time is 0.000068 seconds. Elapsed time is 0.000066 seconds. Elapsed time is 0.000061 seconds. Elapsed time is 0.000062 seconds. Elapsed time is 0.000062 seconds. Elapsed time is 0.000054 seconds. Elapsed time is 0.000053 seconds. Elapsed time is 0.000051 seconds. Elapsed time is 0.000050 seconds. Elapsed time is 0.000123 seconds. Elapsed time is 0.000089 seconds. Elapsed time is 0.000079 seconds. Elapsed time is 0.000061 seconds. Elapsed time is 0.000065 seconds. Elapsed time is 0.000075 seconds. Elapsed time is 0.000136 seconds. Elapsed time is 0.000067 seconds. Elapsed time is 0.000057 seconds. Elapsed time is 0.000070 seconds. Elapsed time is 0.000060 seconds. Elapsed time is 0.000065 seconds. Elapsed time is 0.000116 seconds. Elapsed time is 0.000048 seconds. Elapsed time is 0.000055 seconds. Elapsed time is 0.000054 seconds. Elapsed time is 0.000054 seconds. Elapsed time is 0.000074 seconds. Elapsed time is 0.000043 seconds. Elapsed time is 0.000050 seconds. Elapsed time is 0.000042 seconds. Elapsed time is 0.000040 seconds. Elapsed time is 0.000034 seconds. Elapsed time is 0.000039 seconds. Elapsed time is 0.000034 seconds. Elapsed time is 0.000034 seconds. Elapsed time is 0.000034 seconds. Elapsed time is 0.000036 seconds. Elapsed time is 0.000036 seconds. Elapsed time is 0.000034 seconds. Elapsed time is 0.000034 seconds. Elapsed time is 0.000035 seconds. Elapsed time is 0.000096 seconds. Elapsed time is 0.000031 seconds. Elapsed time is 0.000030 seconds. Elapsed time is 0.000026 seconds. Elapsed time is 0.000072 seconds. Elapsed time is 0.000028 seconds. Elapsed time is 0.000067 seconds. Elapsed time is 0.000026 seconds. Elapsed time is 0.000024 seconds. Elapsed time is 0.000025 seconds. Elapsed time is 0.000026 seconds. Elapsed time is 0.000024 seconds. Elapsed time is 0.000025 seconds. Elapsed time is 0.000080 seconds. Elapsed time is 0.000015 seconds. Elapsed time is 0.000013 seconds. Elapsed time is 0.000014 seconds. Elapsed time is 0.000012 seconds. Elapsed time is 0.000012 seconds. Elapsed time is 0.000013 seconds. Elapsed time is 0.000018 seconds. Elapsed time is 0.000012 seconds. Elapsed time is 0.000011 seconds. Elapsed time is 0.000018 seconds. Elapsed time is 0.000012 seconds. Elapsed time is 0.000010 seconds. Elapsed time is 0.000011 seconds. Elapsed time is 0.000009 seconds. Elapsed time is 0.000010 seconds. Elapsed time is 0.000019 seconds. Elapsed time is 0.000011 seconds. Elapsed time is 0.000028 seconds. Elapsed time is 0.000009 seconds. Elapsed time is 0.000010 seconds. Elapsed time is 0.000009 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000014 seconds. Elapsed time is 0.000009 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000009 seconds. Elapsed time is 0.000010 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000012 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000021 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000011 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000010 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000109 seconds. Elapsed time is 0.000013 seconds. Elapsed time is 0.000009 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000009 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000010 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000039 seconds. Elapsed time is 0.000033 seconds. Elapsed time is 0.000451 seconds. Elapsed time is 0.000009 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000029 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000017 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000201 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000062 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000004 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000004 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000009 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000004 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000004 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000004 seconds. Elapsed time is 0.000155 seconds. Elapsed time is 0.000009 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000004 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000004 seconds. Elapsed time is 0.000004 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000004 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000062 seconds. Elapsed time is 0.000042 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000011 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000010 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000011 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000009 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000010 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000010 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000009 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000011 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000009 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000010 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000669 seconds. Elapsed time is 0.000010 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000011 seconds. Elapsed time is 0.000008 seconds. Elap...

4   Pass
assert(isequal(decimate(30,5),3))

Elapsed time is 0.000623 seconds. Elapsed time is 0.000037 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000019 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000011 seconds. Elapsed time is 0.000084 seconds. Elapsed time is 0.000028 seconds. Elapsed time is 0.000012 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000012 seconds. Elapsed time is 0.000071 seconds. survivor = 3

5   Pass
assert(isequal(decimate(10,10),8))

Elapsed time is 0.000228 seconds. Elapsed time is 0.000033 seconds. Elapsed time is 0.000013 seconds. Elapsed time is 0.000010 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000011 seconds. Elapsed time is 0.000004 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000004 seconds. Elapsed time is 0.000004 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000004 seconds. Elapsed time is 0.000004 seconds. Elapsed time is 0.000004 seconds. Elapsed time is 0.000004 seconds. Elapsed time is 0.000112 seconds. survivor = 8

6   Pass
assert(isequal(decimate(2048,2),1))

Elapsed time is 0.005387 seconds. Elapsed time is 0.003136 seconds. Elapsed time is 0.001267 seconds. Elapsed time is 0.000507 seconds. Elapsed time is 0.000415 seconds. Elapsed time is 0.000125 seconds. Elapsed time is 0.000065 seconds. Elapsed time is 0.000038 seconds. Elapsed time is 0.000025 seconds. Elapsed time is 0.000018 seconds. Elapsed time is 0.000016 seconds. Elapsed time is 0.000550 seconds. survivor = 1