Painting a different board in a particular way I would like to know if anyone of you can help me to understand the following question:
You have to paint this board

You need to paint each of those squares in a particular way:

*

*Three cells must be white;

*Three cells must be gray;

*Four cells must be black;

*You can not paint of black two cells that share a commum side

I tried to do it using Inclusion-exclusion principle, but I did not succeed. I would appreciate some help with this problem.
 A: As there are restrictions on which cells can be painted black, let's first find all combinations of $4$ cells that can be painted black and let's call them good cells. Call columns of square with $9$ cells, $A, B, C$ from left to right and rows $1, 2, 3$ from top to bottom.

Case 1: Cell $0$ is painted black. So cell $A2$ is ruled out and we have to choose $3$ good cells from rest $8$.
a) Column $A$ has no good cells
Column $B$ can have either $1$ or $2$ good cells. Column $C$ can have either $2$ or $1$ good cells based on column $B$.
As we need $3$ good cells, number of ways $= 2$
b) Column $A$ has $1$ good cell
Number of possible ways: $2$ (cell $A1$ or $A3$)
Column $B$ can have only i) $0$ good cell or ii) $1$ good cell in $2$ possible ways for each good cell in column $A$.
Column $C$ can have only i) $2$ good cell in $1$ possible way or ii) $1$ good cell in $2$ possible ways for each good cell in column $B$.
Number of possible ways = $2 \times (1+2 \times 2) = 10$.
c) Column $A$ has $2$ good cells
Number of possible ways: $1$ (cells $A1, A3$)
Column $B$ can have only i) $0$ good cell or ii) $1$ good cell in $1$ possible way.
Column $C$ can have only i) $1$ good cell in $3$ possible ways or ii) $0$ good cell.
Number of possible ways $= 1 + 3 = 4$.
So total number of combinations for Case $1 = 16$
Case 2: cell $0$ is not painted black. So we have to choose $4$ good cells from rest $9$.
Case $2$ is more straightforward as it has more restrictions.
$1$ good cell each in column $A$ ($A1$ or $A3$) and column $B$ ($B2$) and $2$ in column $C$ ($C1, C3$): $2$ possible ways
Similarly, $2$ good cells in column $A$, $1$ each in column $B$ and $C$: $2$ possible ways
$1$ good cell in column $A$ ($A2$), $2$ in column $B$ ($B1, B3$) and $1$ in column $C$ ($C1$): $1$ possible way
$2$ good cell in column $A$ ($A1, A3$) and $2$ in column $C$ ($C1, C3$): $1$ possible way
So total number of combinations for Case $2 = 6$
Total number of valid combinations of $4$ black cells $= 22$.
Now, we can choose $3$ cells out of remaining $6$ to paint white in $^6C_3$ ways. Rest $3$ will automatically be grey.
So total number of valid ways to paint = $22 \times ^6C_3 = 440$
