Let be the number of rectangles, not necessarily axis-parallel, whose vertices belong to the square grid of lattice points. We give an exact algorithm that computes one prescribed value in arithmetic operations and arithmetic words of working memory. The algorithm decomposes the count into Möbius divisor layers, partitions weighted floor-moment queries by a truncated Euclidean coefficient-cone recursion, and reuses uniform marker grids along common coefficient paths. Each marker requires only its uniform cell and constant-size corrections at nearby boundaries, which select an exact precompiled cell operator. All integer operands have bits. An exact 128-bit C++ implementation for the reported input range is compared experimentally with the previous algorithm.

生成讲解博客的中文版本

生成AI智能校验的中文版本