Problem statement confusion (2019 Feb Gold)

In the problem Painting the Barn, the sample test cases produce the following (truncated) grid (number in the cell represents the number of coats of paint applied):


Now, we can paint regions (2,7)\rarr (8,7) and (8,2)\rarr (8,6) to give a total of 33 cells with 2 coats of paint. However, the answer states 26.

What is the mistake in my diagram or notation?


The coordinates they give you aren’t cell-wise- they’re point-wise.

For example, for the first rectangle, 1 1 and 4 4, the diagram you provided provides a 4 x 4 painted region, while it’s actually only a 3 x 3 painted region.

(disorienting, i know)

1 Like

Thanks a lot! Kept banging my head for 3 hours on the sample tests.
How silly of me, smh…