Number of Empty Subgrids in a Grid

In CodeForces, I posted a tutorial on how to count the number of empty subgrids in a grid because I couldn’t find any tutorial for this specific problem online and it has a score of -13 with no hate comments.

Did I somehow mess up with my algorithm? I am pretty sure it is correct since I have tested it with a few examples and I also solved CHSGMNTS with this algorithm. Therefore, I do not understand how this post got -13 on CodeForces. Did I mess up with my algorithm here or are people on CodeForces just really mean and downvote a lot for no good reason?

CodeForces Community isn’t that good with Upvoting and appreciating such stuff. These days, they just downvote every comment and post for no reason. I know that, the algorithm ends up being O(height*width), but I am still not able to prove it myself. Your last statement also does not convince me :confused:

But overall, the description and code seems correct enough. I am not sure, were that downvotes for some wrong algorithm.

I upvoted it there though :wink:

Thanks for the upvotes! For me, in order to see how it was O(height\cdot width), I did this algorithm for a small test case (5-by-6 grid) and saw how many times the while loop ran throughout the algorithm and saw that it does not run more than O(height \cdot width) times.