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

Автор simp1eton, 14 лет назад, По-английски
Hi all,

I have a question about the maximal convex hull polygon. You are given N points on a 2D plane. Each point has a value X. You want to find the convex polygon such that the sum of the value of the points on the perimeter of the polygon is maximal. Output the maximal sum.

I have an N^4 DP solution. as follows.

I choose a point i and sort all the other points around this point according to angle (similar to convex hull graham scan). Then, I write the following bottom-up dp formulation:

DP[B][A] stores the best convex polygon with the last two points at B and A.

Then I calculate DP[C][B] for all C such that C-B-A is convex and I-C-B is convex.

The DP has a runtime of N^3. As I am doing this DP for all vertices I, the algorithm has a total runtime of N^4.

However, I think that there is a better algorithm with a runtime of N^3. Does anyone know this algorithm? Can someone give me some hints?

Thanks in advance!
  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

14 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится
Anyone?

This is the problem: http://www.z-trening.com/tasks.php?show_task=5000000255
14 лет назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

I saw the task.

I am sorry, but I cant understand why is example output 4.

I think it should be 5 , plz clarify.

-----------------------------


EDIT: got it .

14 лет назад, # |
Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится
The DP runtime can be O(n^2) for each point.
First, sort other points by polar angle for each point. This is O(n^2logn). Then we can handle the DP by a rotating sweepline, it is O(n^3). So, total is O(n^2logn + n^3)=O(n^3).
14 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится
More details, you can see here.