Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Блог пользователя olivergrant

Автор olivergrant, история, 8 месяцев назад, По-английски

A common D&C question is to find the non-dominated points. This can be done in $$$O(n \log n)$$$ by sorting the points by x value, splitting them in half and then finding the solution on each side. We combine them by noticing that we just need to find the right-most point that is not dominated by the right side.

Now, I'm curious to know the opposite. How can we find the dominance factor of all points? That is, how would I go about finding the number of points that dominate point $$$(x_i, y_i)$$$?

I'm thinking about something along the lines of counting inversions but cannot formalize my idea.

  • Проголосовать: нравится
  • +8
  • Проголосовать: не нравится

»
8 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Sort points by decreasing $$$x$$$. The points that dominate $$$(x_i, y_i)$$$ are the points with higher $$$x_i$$$ and higher $$$y_i$$$, so they are the points processed before $$$i$$$ and with higher $$$y_i$$$. So you can either store the $$$y_i$$$ in a Fenwick tree / PBDS, or use this type of D&C.