Cody

# Problem 1092. Decimation

Solution 2279978

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.000495 seconds. Elapsed time is 0.000850 seconds. Elapsed time is 0.000368 seconds. Elapsed time is 0.000207 seconds. Elapsed time is 0.001455 seconds. survivor = 4

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

Elapsed time is 0.001257 seconds. Elapsed time is 0.000802 seconds. Elapsed time is 0.000439 seconds. Elapsed time is 0.000326 seconds. Elapsed time is 0.000150 seconds. Elapsed time is 0.000056 seconds. Elapsed time is 0.000015 seconds. Elapsed time is 0.000009 seconds. Elapsed time is 0.000040 seconds. Elapsed time is 0.000036 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000035 seconds. Elapsed time is 0.000015 seconds. Elapsed time is 0.000135 seconds. Elapsed time is 0.000261 seconds. Elapsed time is 0.000505 seconds. survivor = 676

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

Elapsed time is 0.000680 seconds. Elapsed time is 0.000185 seconds. Elapsed time is 0.000209 seconds. Elapsed time is 0.000174 seconds. Elapsed time is 0.000118 seconds. Elapsed time is 0.000114 seconds. Elapsed time is 0.000111 seconds. Elapsed time is 0.000139 seconds. Elapsed time is 0.000102 seconds. Elapsed time is 0.000099 seconds. Elapsed time is 0.000156 seconds. Elapsed time is 0.000124 seconds. Elapsed time is 0.000088 seconds. Elapsed time is 0.000087 seconds. Elapsed time is 0.000083 seconds. Elapsed time is 0.000077 seconds. Elapsed time is 0.000078 seconds. Elapsed time is 0.000122 seconds. Elapsed time is 0.000104 seconds. Elapsed time is 0.000069 seconds. Elapsed time is 0.000068 seconds. Elapsed time is 0.000082 seconds. Elapsed time is 0.000061 seconds. Elapsed time is 0.000062 seconds. Elapsed time is 0.000057 seconds. Elapsed time is 0.000056 seconds. Elapsed time is 0.000075 seconds. Elapsed time is 0.000052 seconds. Elapsed time is 0.000050 seconds. Elapsed time is 0.000122 seconds. Elapsed time is 0.000095 seconds. Elapsed time is 0.000079 seconds. Elapsed time is 0.000071 seconds. Elapsed time is 0.000073 seconds. Elapsed time is 0.000073 seconds. Elapsed time is 0.000141 seconds. Elapsed time is 0.000076 seconds. Elapsed time is 0.000066 seconds. Elapsed time is 0.000070 seconds. Elapsed time is 0.000056 seconds. Elapsed time is 0.000059 seconds. Elapsed time is 0.000124 seconds. Elapsed time is 0.000057 seconds. Elapsed time is 0.000049 seconds. Elapsed time is 0.000057 seconds. Elapsed time is 0.000053 seconds. Elapsed time is 0.000052 seconds. Elapsed time is 0.000049 seconds. Elapsed time is 0.000051 seconds. Elapsed time is 0.000046 seconds. Elapsed time is 0.000046 seconds. Elapsed time is 0.000044 seconds. Elapsed time is 0.000042 seconds. Elapsed time is 0.000041 seconds. Elapsed time is 0.000037 seconds. Elapsed time is 0.000041 seconds. Elapsed time is 0.000039 seconds. Elapsed time is 0.000037 seconds. Elapsed time is 0.000035 seconds. Elapsed time is 0.000035 seconds. Elapsed time is 0.000035 seconds. Elapsed time is 0.000035 seconds. Elapsed time is 0.000031 seconds. Elapsed time is 0.000033 seconds. Elapsed time is 0.000024 seconds. Elapsed time is 0.000041 seconds. Elapsed time is 0.000017 seconds. Elapsed time is 0.000037 seconds. Elapsed time is 0.000016 seconds. Elapsed time is 0.000015 seconds. Elapsed time is 0.000014 seconds. Elapsed time is 0.000015 seconds. Elapsed time is 0.000015 seconds. Elapsed time is 0.000014 seconds. Elapsed time is 0.000020 seconds. Elapsed time is 0.000014 seconds. Elapsed time is 0.000014 seconds. Elapsed time is 0.000014 seconds. Elapsed time is 0.000012 seconds. Elapsed time is 0.000012 seconds. Elapsed time is 0.000012 seconds. Elapsed time is 0.000011 seconds. Elapsed time is 0.000011 seconds. Elapsed time is 0.000010 seconds. Elapsed time is 0.000011 seconds. Elapsed time is 0.000010 seconds. Elapsed time is 0.000010 seconds. Elapsed time is 0.000010 seconds. Elapsed time is 0.000010 seconds. Elapsed time is 0.000010 seconds. Elapsed time is 0.000009 seconds. Elapsed time is 0.000010 seconds. Elapsed time is 0.000025 seconds. Elapsed time is 0.000010 seconds. Elapsed time is 0.000009 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000009 seconds. Elapsed time is 0.000009 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000009 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000019 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.000006 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.000006 seconds. Elapsed time is 0.000005 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.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.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.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.000150 seconds. Elapsed time is 0.000011 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.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.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.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.000006 seconds. Elapsed time is 0.000005 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.000005 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.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000038 seconds. Elapsed time is 0.000027 seconds. Elapsed time is 0.000443 seconds. Elapsed time is 0.000009 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000028 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000016 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000233 seconds. Elapsed time is 0.000009 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000063 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000004 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.000005 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.000004 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.000179 seconds. Elapsed time is 0.000012 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000004 seconds. Elapsed time is 0.000004 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.000004 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000004 seconds. Elapsed time is 0.000028 seconds. Elapsed time is 0.000030 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000004 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000004 seconds. Elapsed time is 0.000004 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.000005 seconds. Elapsed time is 0.000004 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.000004 seconds. Elapsed time is 0.000004 seconds. Elapsed time is 0.000003 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.000006 seconds. Elapsed time is 0.000004 seconds. Elapsed time is 0.000003 seconds. Elapsed time is 0.000004 seconds. Elapsed time is 0.000003 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000004 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.000007 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.000004 seconds. Elapsed time is 0.000004 seconds. Elapsed time is 0.000438 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000006 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.000007 seconds. Elapsed time is 0.000004 seconds. Elap...

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

Elapsed time is 0.000557 seconds. Elapsed time is 0.000022 seconds. Elapsed time is 0.000007 seconds. Elapsed time is 0.000016 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000011 seconds. Elapsed time is 0.000086 seconds. Elapsed time is 0.000026 seconds. Elapsed time is 0.000012 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000004 seconds. Elapsed time is 0.000009 seconds. survivor = 3

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

Elapsed time is 0.000222 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000009 seconds. Elapsed time is 0.000008 seconds. Elapsed time is 0.000005 seconds. Elapsed time is 0.000004 seconds. Elapsed time is 0.000006 seconds. Elapsed time is 0.000011 seconds. Elapsed time is 0.000004 seconds. Elapsed time is 0.000005 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.000006 seconds. survivor = 8

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

Elapsed time is 0.005668 seconds. Elapsed time is 0.003211 seconds. Elapsed time is 0.001307 seconds. Elapsed time is 0.000621 seconds. Elapsed time is 0.000249 seconds. Elapsed time is 0.000126 seconds. Elapsed time is 0.000066 seconds. Elapsed time is 0.000038 seconds. Elapsed time is 0.000023 seconds. Elapsed time is 0.000017 seconds. Elapsed time is 0.000017 seconds. survivor = 1