Problem 4.6. Zhenya took a $3 \times 3$ board and placed a column of blue and red cubes on each cell. Then he drew a diagram of the resulting arrangement: he labeled the number of cubes of both colors in each column (the order of the cubes is unknown).

What is the maximum number of blue cubes Zhenya can see if he looks at the construction from the front? (For example, if a column of 8 cubes is in front of a column of 5, then all 5 cubes of the closer column and only the top 3 cubes of the farther column will be visible.)

![](https://cdn.mathpix.com/cropped/2024_05_06_c60160c61c72db74c711g-4.jpg?height=434&width=297&top_left_y=110&top_left_x=574)
Answer: 12.

Solution. Let's understand the maximum number of blue cubes Zhenya can see in each of the three rows: left, middle, and right.

Left row. The first column consists of 5 cubes (2 red and 3 blue), so it completely blocks the second column, as well as 5 out of 7 cubes in the last column.

Thus, Zhenya sees all the cubes in the first column (3 of which are blue), as well as 2 cubes from the last column (both can be blue). That is, in this row, he will see a maximum of $3+2=5$ blue cubes.

Middle row. The first column consists of 4 cubes (2 red and 2 blue), so it completely blocks the last column, as well as 4 out of 5 cubes in the second column.

Thus, Zhenya sees all the cubes in the first column (2 of which are blue), as well as 1 cube from the second column (it can be blue). That is, in this row, he will see a maximum of $2+1=3$ blue cubes.

Right row. The first column consists of 3 cubes (2 red and 1 blue), so it blocks 3 out of 6 cubes in the second column. Meanwhile, the second column completely blocks the last column.

Thus, Zhenya sees all the cubes in the first column (1 of which is blue), as well as 3 cubes from the second column (all three can be blue). That is, in this row, he will see a maximum of $1+3=4$ blue cubes.

In total, Zhenya will see a maximum of $5+3+4=12$ blue cubes.