Need help in Painting the Barn

I am not getting what this problem https://usaco.guide/silver/prefix-sums-2#problem-usaco-919
is asking , can anyone help please

FJ applied several coats of paint on the farm wall… let us consider the wall in image
As stated in the question FJ paint the wall in form of rectangles, so he first paint the red rectangle (colors are here only for better understanding, In problem there’s only a single color) , blue and lime.
Now what we want to find that area which is covered with exactly k coats.

coat on a single square = No. of rectangles have that square in common

we can clearly see that the middle (yellow part) have 3 coats and two colored part have 2 coats.

that’s all about this problem… If something is confusion feel free to point out.

PS : Sorry for my bad English.

2 Likes

Great explanation :slightly_smiling_face: , thank you…