If (x,y) is an original coordinate, add both x and x+1 to the set of x coordinates we want to compress (same for y). The compressed coordinate x_compressed represents the interval [x_orig[x_compressed], x_orig[x_compressed+1]), and the +1 part always exists for our original set of coordinates.
Yep, this is correct - I think I confused myself by thinking about whether the boundary itself lies on the inside or outside of a compressed cell and how to count its area appropriately, but this is just wrong because the boundary itself is fully occupying a compressed cell of width 1 (not sure if that explanation of my self-confusion made sense haha). Thanks for posting this! When I get a chance I'll try to write up an alternative part 2 solution that uses this compression.
Well done! Also, making leaderboard at a PC방!? On vacation?
If (x,y) is an original coordinate, add both x and x+1 to the set of x coordinates we want to compress (same for y). The compressed coordinate x_compressed represents the interval [x_orig[x_compressed], x_orig[x_compressed+1]), and the +1 part always exists for our original set of coordinates.
Yep, this is correct - I think I confused myself by thinking about whether the boundary itself lies on the inside or outside of a compressed cell and how to count its area appropriately, but this is just wrong because the boundary itself is fully occupying a compressed cell of width 1 (not sure if that explanation of my self-confusion made sense haha). Thanks for posting this! When I get a chance I'll try to write up an alternative part 2 solution that uses this compression.