m × n hangs from the ceiling: panel[i][j] = 1 means the cell holds a block, 0 means it is empty. Row 0 is attached to the ceiling.
A block **holds** if it is in row 0 or at least one of its four side neighbours is a block that holds.
The panel takes a sequence of strikes strikes[i] = [row, col]. A strike knocks out the block in that cell, if there is one. Right after that, every block that no longer holds falls and disappears from the panel (falling blocks do not land on other blocks).
Return an array whose i-th element is the number of blocks that fell after the i-th strike, not counting the struck block itself. A strike may hit an empty cell, in which case nothing falls.panel=[[0, 1, 0], [1, 1, 1], [1, 0, 1]], strikes=[[1, 1]] → [4]
The whole lower pattern hung from the centre block. Once it is knocked out, four blocks fall: the two at the sides of the second row and the two in the third row.
panel=[[1, 1], [1, 1]], strikes=[[1, 0], [0, 1], [0, 0]] → [0, 1, 0]
The first strike removes one block and the rest still hold. After the second strike, block (1, 1) has nothing left to hang on: (0, 1) was just knocked out and (1, 0) was knocked out earlier, so it falls. The third strike removes the last block and nothing else falls.
panel=[[1, 0], [0, 0]], strikes=[[1, 1]] → [0]
The strike hits an empty cell, so nothing falls.
m, n ≤ 200panel[i][j] is 0 or 1len(strikes) ≤ 4·10⁴row < m, 0 ≤ col < npanel=[[0, 1, 0], [1, 1, 1], [1, 0, 1]], strikes=[[1, 1]]
[4]
Run checks the first 3 tests in your browser. Submit checks all 87 tests on the server, hidden ones included.