Editorial for COCI '19 Contest 5 #1 Emacs


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

The number of rectangles in the image is equal to the number of upper-left corners of rectangles in the image. Cell (i, j) is an upper-left corner of some rectangle if that cell contains the character * while cells (i-1, j) and (i, j-1) (if they exist) contain the character ..

Alternatively, we can use BFS to find the number of connected components in four general directions which contain the character *.


Comments

There are no comments at the moment.