Black Squares — Solution & Editorial
Black cells are those with even (r+c); counting them gives ceil(NM/2) when (1,1) is black.
Complexity: O(1)
Black cells are those with even (r+c); counting them gives ceil(NM/2) when (1,1) is black.
Complexity: O(1)