Cody

Problem 1630. ~~~~~~~ WAVE ~~~~~~~~~

Solution 583727

Submitted on 17 Feb 2015 by Zikobrelli
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
%% stone = 2; waves =[1 1; 1 2]; assert(isequal( WAVE(stone),waves))

A = 0 0 0 0 A = 1 1 0 0 A = 1 1 1 0 A = 1 1 1 2 A = 1 1 1 2

2   Pass
%% stone = 3; waves = [1 1 1; 1 2 2; 1 2 3]; assert(isequal( WAVE(stone),waves))

A = 0 0 0 0 0 0 0 0 0 A = 1 1 1 0 0 0 0 0 0 A = 1 1 1 1 0 0 1 0 0 A = 1 1 1 1 2 2 1 0 0 A = 1 1 1 1 2 2 1 2 0 A = 1 1 1 1 2 2 1 2 3 A = 1 1 1 1 2 2 1 2 3

3   Pass
%% stone = 4; waves = [ 1 1 1 1; 1 2 2 2; 1 2 3 3; 1 2 3 4;]; assert(isequal( WAVE(stone),waves))

A = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 A = 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 A = 1 1 1 1 1 0 0 0 1 0 0 0 1 0 0 0 A = 1 1 1 1 1 2 2 2 1 0 0 0 1 0 0 0 A = 1 1 1 1 1 2 2 2 1 2 0 0 1 2 0 0 A = 1 1 1 1 1 2 2 2 1 2 3 3 1 2 0 0 A = 1 1 1 1 1 2 2 2 1 2 3 3 1 2 3 0 A = 1 1 1 1 1 2 2 2 1 2 3 3 1 2 3 4 A = 1 1 1 1 1 2 2 2 1 2 3 3 1 2 3 4

4   Pass
%% stone = 6; waves = [ 1 1 1 1 1 1; 1 2 2 2 2 2; 1 2 3 3 3 3; 1 2 3 4 4 4; 1 2 3 4 5 5; 1 2 3 4 5 6]; assert(isequal( WAVE(stone),waves))

A = 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 A = 1 1 1 1 1 1 0 0 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