On the DP algorithm suspended line method

Hanging line method

  • use

To solve the biggest sub-matrix-matrix satisfies a condition

  • practice

With a line (vertical line are seemingly) does not satisfy the left or right until it reaches the boundary constraint or

  • definition

\ (left [i] [J] \) : Representative from \ ((i, j) \ ) can reach the leftmost position

\ (right [I] [J] \) : Representative from \ ((i, j) \ ) can reach the rightmost position

\ (up [I] [J] \) : Representative from \ ((i, j) \ ) extend upwardly longest length .

  • State transition

\[left[i][j]=max(left[i][j],left[i-1][j])\]

\[right[i][j]=min(right[i][j],right[i-1][j])\]

  • As for why recurrence formula in the case of one of the considerations?

Because \ (up \) to define arrays, \ (up \) array represents the maximum length of the scale-up, it is necessary to consider the case where the upper hierarchy.

Reference Hirofumi: Https://Rpdreamer.Blog.Luogu.Org/p1169

Guess you like

Origin www.cnblogs.com/hulean/p/11919859.html