Cody

Solution 1691455

Submitted on 13 Dec 2018 by Binbin Qi
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
n = 2; breakpoints = unique(Chains(n)); % Check minimum length condition is satisfied assert(length(breakpoints)<=1,'Argghh...You failed to release Kratos. Too many breakpoints') % Get broken chain segements segments = abs(nonzeros([repelem(1,length(breakpoints)) [breakpoints-1 n]-[0 breakpoints]])); % Check that chain of any integer length between 1 and n links, inclusive, % can be obtained from the resulting segments assert(length(unique((dec2bin(1:2^length(segments)-1)-'0')*segments)')==n, 'Argghh...You failed to release Kratos. Incorrect breakpoints')

2   Pass
n = 3; breakpoints = unique(Chains(n)); % Check minimum length condition is satisfied assert(length(breakpoints)<=1,'Argghh...You failed to release Kratos. Too many breakpoints') % Get broken chain segements segments = abs(nonzeros([repelem(1,length(breakpoints)) [breakpoints-1 n]-[0 breakpoints]])); % Check that chain of any integer length between 1 and n links, inclusive, % can be obtained from the resulting segments assert(length(unique((dec2bin(1:2^length(segments)-1)-'0')*segments)')==n,'Argghh...You failed to release Kratos. Incorrect breakpoints')

3   Pass
n = 5; breakpoints = unique(Chains(n)); % Check minimum length condition is satisfied assert(length(breakpoints)<=1,'Argghh...You failed to release Kratos. Too many breakpoints') % Get broken chain segements segments = abs(nonzeros([repelem(1,length(breakpoints)) [breakpoints-1 n]-[0 breakpoints]])); % Check that chain of any integer length between 1 and n links, inclusive, % can be obtained from the resulting segments assert(length(unique((dec2bin(1:2^length(segments)-1)-'0')*segments)')==n,'Argghh...You failed to release Kratos. Incorrect breakpoints')

4   Pass
n = 7; breakpoints = unique(Chains(n)); % Check minimum length condition is satisfied assert(length(breakpoints)<=1,'Argghh...You failed to release Kratos. Too many breakpoints') % Get broken chain segements segments = abs(nonzeros([repelem(1,length(breakpoints)) [breakpoints-1 n]-[0 breakpoints]])); % Check that chain of any integer length between 1 and n links, inclusive, % can be obtained from the resulting segments assert(length(unique((dec2bin(1:2^length(segments)-1)-'0')*segments)')==n,'Argghh...You failed to release Kratos. Incorrect breakpoints')

5   Pass
n = 8; breakpoints = unique(Chains(n)); % Check minimum length condition is satisfied assert(length(breakpoints)<=2,'Argghh...You failed to release Kratos. Too many breakpoints') % Get broken chain segements segments = abs(nonzeros([repelem(1,length(breakpoints)) [breakpoints-1 n]-[0 breakpoints]])); % Check that chain of any integer length between 1 and n links, inclusive, % can be obtained from the resulting segments assert(length(unique((dec2bin(1:2^length(segments)-1)-'0')*segments)')==n,'Argghh...You failed to release Kratos. Incorrect breakpoints')

6   Pass
n = 23; breakpoints = unique(Chains(n)); % Check minimum length condition is satisfied assert(length(breakpoints)<=2,'Argghh...You failed to release Kratos. Too many breakpoints') % Get broken chain segements segments = abs(nonzeros([repelem(1,length(breakpoints)) [breakpoints-1 n]-[0 breakpoints]])); % Check that chain of any integer length between 1 and n links, inclusive, % can be obtained from the resulting segments assert(length(unique((dec2bin(1:2^length(segments)-1)-'0')*segments)')==n,'Argghh...You failed to release Kratos. Incorrect breakpoints')

7   Pass
n = 50; breakpoints = unique(Chains(n)); % Check minimum length condition is satisfied assert(length(breakpoints)<=3,'Argghh...You failed to release Kratos. Too many breakpoints') % Get broken chain segements segments = abs(nonzeros([repelem(1,length(breakpoints)) [breakpoints-1 n]-[0 breakpoints]])); % Check that chain of any integer length between 1 and n links, inclusive, % can be obtained from the resulting segments assert(length(unique((dec2bin(1:2^length(segments)-1)-'0')*segments)')==n,'Argghh...You failed to release Kratos. Incorrect breakpoints')

8   Pass
n = 100; breakpoints = unique(Chains(n)); % Check minimum length condition is satisfied assert(length(breakpoints)<=4,'Argghh...You failed to release Kratos. Too many breakpoints') % Get broken chain segements segments = abs(nonzeros([repelem(1,length(breakpoints)) [breakpoints-1 n]-[0 breakpoints]])); % Check that chain of any integer length between 1 and n links, inclusive, % can be obtained from the resulting segments assert(length(unique((dec2bin(1:2^length(segments)-1)-'0')*segments)')==n,'Argghh...You failed to release Kratos. Incorrect breakpoints')

9   Pass
n = 150; breakpoints = unique(Chains(n)); % Check minimum length condition is satisfied assert(length(breakpoints)<=4,'Argghh...You failed to release Kratos. Too many breakpoints') % Get broken chain segements segments = abs(nonzeros([repelem(1,length(breakpoints)) [breakpoints-1 n]-[0 breakpoints]])); % Check that chain of any integer length between 1 and n links, inclusive, % can be obtained from the resulting segments assert(length(unique((dec2bin(1:2^length(segments)-1)-'0')*segments)')==n,'Argghh...You failed to release Kratos. Incorrect breakpoints')

10   Pass
n = 200; breakpoints = unique(Chains(n)); % Check minimum length condition is satisfied assert(length(breakpoints)<=5,'Argghh...You failed to release Kratos. Too many breakpoints') % Get broken chain segements segments = abs(nonzeros([repelem(1,length(breakpoints)) [breakpoints-1 n]-[0 breakpoints]])); % Check that chain of any integer length between 1 and n links, inclusive, % can be obtained from the resulting segments assert(length(unique((dec2bin(1:2^length(segments)-1)-'0')*segments)')==n,'Argghh...You failed to release Kratos. Incorrect breakpoints')

11   Pass
n = 500; breakpoints = unique(Chains(n)); % Check minimum length condition is satisfied assert(length(breakpoints)<=6,'Argghh...You failed to release Kratos. Too many breakpoints') % Get broken chain segements segments = abs(nonzeros([repelem(1,length(breakpoints)) [breakpoints-1 n]-[0 breakpoints]])); % Check that chain of any integer length between 1 and n links, inclusive, % can be obtained from the resulting segments assert(length(unique((dec2bin(1:2^length(segments)-1)-'0')*segments)')==n,'Argghh...You failed to release Kratos. Incorrect breakpoints')

12   Pass
n = 1000; breakpoints = unique(Chains(n)); % Check minimum length condition is satisfied assert(length(breakpoints)<=7,'Argghh...You failed to release Kratos. Too many breakpoints') % Get broken chain segements segments = abs(nonzeros([repelem(1,length(breakpoints)) [breakpoints-1 n]-[0 breakpoints]])); % Check that chain of any integer length between 1 and n links, inclusive, % can be obtained from the resulting segments assert(length(unique((dec2bin(1:2^length(segments)-1)-'0')*segments)')==n,'Argghh...You failed to release Kratos. Incorrect breakpoints')

13   Pass
n = 2500; breakpoints = unique(Chains(n)); % Check minimum length condition is satisfied assert(length(breakpoints) <= 8,'Argghh...You failed to release Kratos. Too much breakpoints') % Get broken chain segements segments = abs(nonzeros([repelem(1,length(breakpoints)) [breakpoints-1 n]-[0 breakpoints]])); % Check that chain of any integer length between 1 and n links, inclusive, % can be obtained from the resulting segments assert(length(unique((dec2bin(1:2^length(segments)-1)-'0')*segments)')==n,'Argghh...You failed to release Kratos. Incorrect breakpoints')

14   Pass
n = 5000; breakpoints = unique(Chains(n)); % Check minimum length condition is satisfied assert(length(breakpoints)<=9,'Argghh...You failed to release Kratos. Too many breakpoints') % Get broken chain segements segments = abs(nonzeros([repelem(1,length(breakpoints)) [breakpoints-1 n]-[0 breakpoints]])); % Check that chain of any integer length between 1 and n links, inclusive, % can be obtained from the resulting segments assert(length(unique((dec2bin(1:2^length(segments)-1)-'0')*segments)')==n,'Argghh...You failed to release Kratos. Incorrect breakpoints')

15   Pass
n = 10000; breakpoints = unique(Chains(n)); % Check minimum length condition is satisfied assert(length(breakpoints)<=9,'Argghh...You failed to release Kratos. Too many breakpoints') % Get broken chain segements segments = abs(nonzeros([repelem(1,length(breakpoints)) [breakpoints-1 n]-[0 breakpoints]])); % Check that chain of any integer length between 1 and n links, inclusive, % can be obtained from the resulting segments assert(length(unique((dec2bin(1:2^length(segments)-1)-'0')*segments)')==n,'Argghh...You failed to release Kratos. Incorrect breakpoints')

16   Pass
n = 20000; breakpoints = unique(Chains(n)); % Check minimum length condition is satisfied assert(length(breakpoints)<=10,'Argghh...You failed to release Kratos. Too many breakpoints') % Get broken chain segements segments = abs(nonzeros([repelem(1,length(breakpoints)) [breakpoints-1 n]-[0 breakpoints]])); % Check that chain of any integer length between 1 and n links, inclusive, % can be obtained from the resulting segments assert(length(unique((dec2bin(1:2^length(segments)-1)-'0')*segments)')==n,'Argghh...You failed to release Kratos. Incorrect breakpoints')