Back to problems

Count queen attacks on points with blockers

Algorithm · Voleon · Hard

Consider an infinite two-dimensional grid of integer lattice points. A queen can attack along a row, a column, or either of the two diagonals. Diagonals are the lines where $$x-y$$ is constant and the lines where $$x+y$$ is constant. In the first phase, there are no obstacles. You are given queens, a list of queen coordinates, and points, a list of query coordinates. For each query point, count how many queens can attack it. A queen and a point on the same row, column, or…

Checking your access…