Company: Visa_3Dec
Difficulty: medium
Block Motif Design You have a sheet of grid paper with n rows and m columns and you want to draw a block motif on it, using pieces shaped like Tetris tiles. There are five kinds of figure, each written below as a rectangle of 1 s and 0 s: a 1 is a cell the figure covers, a 0 is a hole inside its bounding box that the figure leaves untouched. Letter Shape Bounding box A [[1]] 1 x 1 square B [[1, 1, 1]] 1 x 3 bar C [[1, 1], [1, 1]] 2 x 2 square D [[1, 0], [1, 1], [1, 0]] 3 x 2 T-piece, stem on the left E [[0, 1, 0], [1, 1, 1]] 2 x 3 T-piece, tip on top The grid starts out filled with 0 s. The figures are drawn one after another, in the given order, and the i -th figure of the list (counting from 1 ) writes the number i into every cell it covers. To place a figure, look at every position where its bounding box lies completely inside the grid and where all the cells the figure covers are still 0 . The cells the figure leaves as holes may be anything at all — they are simply not touched. Am