Cody

# Problem 2228. Time Expansion

Solution 2236644

Submitted on 26 Apr 2020 by Atsushi Ueno
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=4 x=[2 1 2 3 4 5 -3 4 -1 2 2 2] y_correct = [2 0 0 0 1 0 0 0 2 0 0 0 3 0 0 0 4 0 0 0 5 0 0 0 -3 0 0 0 4 0 0 0 -1 0 0 0 2 0 0 0 2 0 0 0 2]; assert(isequal(time_expansion(x,n),y_correct))

n = 4 x = 2 1 2 3 4 5 -3 4 -1 2 2 2 s = 12 t = 2 1 2 3 4 5 -3 4 -1 2 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u = Columns 1 through 30 2 0 0 0 1 0 0 0 2 0 0 0 3 0 0 0 4 0 0 0 5 0 0 0 -3 0 0 0 4 0 Columns 31 through 48 0 0 -1 0 0 0 2 0 0 0 2 0 0 0 2 0 0 0 ans = Columns 1 through 30 2 0 0 0 1 0 0 0 2 0 0 0 3 0 0 0 4 0 0 0 5 0 0 0 -3 0 0 0 4 0 Columns 31 through 45 0 0 -1 0 0 0 2 0 0 0 2 0 0 0 2

2   Pass
n=1 x=[2 1 2 3 4 5 -3 4 -1 2 2 2] y_correct=x; assert(isequal(time_expansion(x,n),y_correct))

n = 1 x = 2 1 2 3 4 5 -3 4 -1 2 2 2 s = 12 t = 2 1 2 3 4 5 -3 4 -1 2 2 2 u = 2 1 2 3 4 5 -3 4 -1 2 2 2 ans = 2 1 2 3 4 5 -3 4 -1 2 2 2

3   Pass
n=5 x=[2 1 2 3 4] y_correct=[2 0 0 0 0 1 0 0 0 0 2 0 0 0 0 3 0 0 0 0 4]; assert(isequal(time_expansion(x,n),y_correct))

n = 5 x = 2 1 2 3 4 s = 5 t = 2 1 2 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 u = 2 0 0 0 0 1 0 0 0 0 2 0 0 0 0 3 0 0 0 0 4 0 0 0 0 ans = 2 0 0 0 0 1 0 0 0 0 2 0 0 0 0 3 0 0 0 0 4