Even-color twin-station coverage
Grid Algorithms
For every lattice point (x,y) with integer coordinates 0<=x,y<=1000000000, consider Manhattan distances to A=(310000000,410000000) and B=(310180000,410090000). How many points have distance at most 250000 from at least one station AND satisfy x+y even? Count each point only once.
Solve using mathematics, algorithms, or your own code offline. Submit only the final integer here—no program, expression, graph, or written proof.
Check your answer without signing in. Sign in to save your progress.
How to approach this problem
Rotate coordinates using u=x+y and v=x−y: a Manhattan diamond becomes an axis-aligned square. Count integer transformed pairs of the required parity and subtract the intersection. Verify that each diamond is within the original box.
Worked example with different values
The points within Manhattan distance 1 of (0,0) are the origin and four neighbors. Only the origin has even x+y. In rotated coordinates, both u and v must be even.
Apply the same reasoning to the challenge. This example is a separate practice problem.
Learn the technique: Dynamic programming and grid paths