LGMyoshi's blog

By LGMyoshi, history, 23 months ago, In English

Hi all!

I had a question about a commonly known trick for this problem: — Given a set of points(x and y are between 0 and 1e5), calculate the total number of pairs of points that are within a Manhattan distance of 'k'.

I know that you can use a BIT with a sweepline by changing each point to (x + y, x — y). My question is: How does 'k' change when I do the grid rotation / how do I perform queries after the grid rotation?

Thank you in advance!

  • Vote: I like it
  • +1
  • Vote: I do not like it