Please help me solve this problem. I am not able to understand even the editorial.
Square Painting Problem
@anirbandas0206
W and H are width and height of rectangle drawing canvas
For our question W = H = N because its a square
If you use eraser at each valid position complexity will be 0(n^4)
Your solution can have at max 0(n^3)
So pre-calculate number of black cells in each k size segment in rows and cols
When you place an erase somewhere, row will become white if black cells in row == black cells in k size segment from that position
Similarly you can solve for columns
So n^2 cells and n time at each cells gives 0(n^3)
can someone put up the solution for this…this seems llike a difficult problem