rows rows and cols columns, indexed from zero. Some tiles are dark: their coordinates [r, c] are listed in dark, and every other tile is light.
A window is any 2×2 square inside the grid. The window whose top-left corner is (r, c) (with 0 ≤ r < rows − 1, 0 ≤ c < cols − 1) covers cells (r, c), (r, c + 1), (r + 1, c) and (r + 1, c + 1).
Return an array of five numbers where the i-th number is how many windows contain exactly i dark cells.
The grid can be huge while dark cells are relatively few, so going over every window is not the way.rows=2, cols=3, dark=[[0, 1]] → [0, 2, 0, 0, 0]
There are two windows, with top-left corners at (0, 0) and (0, 1). The dark cell (0, 1) lies in both, so each window holds exactly one dark cell.
rows=3, cols=3, dark=[[0, 0], [0, 1], [1, 0], [1, 1]] → [0, 1, 2, 0, 1]
The window at (0, 0) is fully dark (4), the windows at (0, 1) and (1, 0) hold two dark cells each, and the window at (1, 1) holds one.
rows=4, cols=2, dark=[] → [3, 0, 0, 0, 0]
There are no dark cells, so all three windows are empty.
dark are distinctrows=2, cols=3, dark=[[0, 1]]
[0, 2, 0, 0, 0]
Run checks the first 3 tests in your browser. Submit checks all 74 tests on the server, hidden ones included.