100 Classic dynamic planning Equations

Source: Internet
Author: User

1. resource problem 1 ----- machine Allocation Problem

F [I, j] = max (F [I-1, K] + W [I, j-K])

 

2. resource problems 2------01 backpack Problems

F [I, j] = max (F [I-1, J-v] + W, F [I-1, J]);

 

3. Linear Dynamic Programming 1 ----- simple longest non-downsample Sequence

F = max {f [J] + 1}

 

4. Split Question 1 ----- stone merge

F [I, j] = min (F [I, K] + F [k + 1, J] + sum [I, j]);

 

5. Splitting Question 2 ----- polygon splitting

F [I, j] = min (F [I, K] + F [K, J] + A [k] * A [J] * );

 

6. Splitting problem 3 ------ Maximum Product

F [I, j] = max (F [K, J-1] * mult [K, I]);

 

7. resource problems 3 ----- system reliability (full backpack)

F [I, j] = max {f [I-1, J-C * k] * P [I, X]}

 

8. Greedy Dynamic Planning 1 ----- fast food problems

F [I, j, k] = max {f [I-1, J', k'] + (t-(J-J') * P1-(k-k ') * P2) Div P3}

 

9. Greedy Dynamic Planning 2 ---- crossing the river

F = min {f (I-k)} (not stone)

{F (I-k)} + 1} (Stone); + greedy compression status

 

10. Issue 4-polygon-Dynamic Planning discussed

F [I, j] = max {Zheng f [I, K] * f [k + 1, J];

Negative negative G [I, K] * f [k + 1, J];

Positive and negative G [I, K] * f [k + 1, J];

Negative positive F [I, K] * g [k + 1, J];} G is Min

 

11. Tree-based Dynamic Planning 1 ----- additional binary tree (from both sides to the root node model)

F [I, j] = max {f [I, k-1] * f [k + 1, J] + C [k]}

 

12. Tree-based Dynamic Planning 2 ----- course selection (Multi-tree to binary tree, top-down model)

F [I, j] indicates the maximum credits for selecting J course assignments on the root node of I.

F [I, j] = max {f [T. L, K] + F [T. R, j-k-1] + c}

 

13. counting problem 1 ----- weight weighing

F [f [0] + 1] = f [J] + K * W [J];

(1 <= I <= N; 1 <= j <= f [0]; 1 <= k <= ;)

 

14. Recurrence of world 1 ------ Nuclear Power Plant Problems

F [-1] = 1; F [0] = 1;

F = 2 * f [I-1]-f [i-1-m]

 

15. Recursive World 2 ------ division of numbers

F [I, j] = f [I-j, J] + F [I-1, J-1];

 

16. Maximum sub-Matrix 1 ----- A maximum of 01 Sub-Matrix

F [I, j] = min (F [I-1, J], V [I, J-1], V [I-1, J-1]) + 1;

Ans = maxvalue (f );

 

17. determination question 1 ----- can be divisible by 4

G [] = true; G [] = false; G [] = false; G [] = false;

G [I, j] = G [I-1, K] and (K + A [I, p]) mod 4 = J)

 

18. determination question 2 ----- can be divisible by K

F [I, j ± n mod k] = f [I-1, J];-k <= j <= K; 1 <= I <= N

 

20. Linear Dynamic Planning 2 ----- square elimination game

F [I, I-1, 0] = 0

F [I, j, k] = max {f [I, J-1, 0] + sqr (LEN (j) + k ),

F [I, P, K + Len [J] + F [p + 1, J-1, 0]}

Ans = f [1, m, 0]

 

21. Linear Dynamic Planning 3 ----- longest public substring, LCs Problem

F [I, j] = {0 (I = 0) & (j = 0 );

F [I-1, J-1] + 1 (I> 0, j> 0, x = Y [J]);

Max {f [I, J-1] + F [I-1, J]} (I> 0, j> 0, x <> Y [J]);

 

22. Maximum sub-Matrix 2 ----- maximum sub-matrix with weight 01

O (N ^ 2 * m) starts from where it is held. compress it into the sequence and obtain the maximum field sum. If it is 0, it is cleared.

 

23. resource issue 4 ----- Packing Problem (judgement 01 backpack)

F [J] = (F [J] or F [J-v]);

 

24. Digital triangle 1 ----- simple triangle digital triangle

F [I, j] = max (F [I + 1, J] + A [I, j], F [I + 1, J + 1] + A [I, j]);

 

25. Digital triangle 2 ----- hill of the adventures of pig on a sunny day

Dynamic Planning of violence at the same stage

If [I, j] = min (F [I, J-1], F [I, j + 1], F [I-1, J], F [I-1, J-1]) + A [I, j]

 

26. Bidirectional Dynamic Planning 1 digital triangle 3

----- Small fat Certificate

F [I, j] = max (F [I-1, J] + A [I, j], F [I, J-1] + A [I, j], f [I, j + 1] + A [I, j])

 

27. Digital triangle 4 ----- crossing the river

// Initialize the Boundary

F [I, j] = f [I-1, J] + F [I, J-1];

 

28. Digital triangle 5 ----- simple bricks

F [I, j, k] = max (F [I-1, J-k, p] + sum [I, K], F [I, j, k]);

 

29. Number triangle 6 ----- optimized hitting bricks

F [I, j, k] = max {G [I-1, J-K, k-1] + sum [I, K]}

 

30. Linear Dynamic Programming 3 ----- moles'

F = f [J] + 1; (ABS (X-X [J]) + ABS (Y-Y [J]) <= t-t [J])

 

31. Tree-based Dynamic Planning 3 ----- greedy 9-Dragon

32. State compression Dynamic Planning 1 ----- artillery positions

Max (F [Q * (R + 1) + K], G [J] + num [k])

If (MAP and plan [k] = 0) and

(Plan [p] or plan [Q]) and Plan [k] = 0)

 

33. Recurrence World 3 ----- love letter Reader

F = f [I-1] + K * f [I-2]

 

34. Recurrence World 4 ----- misplaced Arrangement

F = (I-1) (F [I-2] + F [I-1]);

F [N] = N * f [n-1] + (-1) ^ (n-2 );

 

35. Recurrence world 5 ----- maximum number of area in a straight line split plane

F [N] = f [n-1] + n

= N * (n + 1) Div 2 + 1;

 

36. Recursive world 6 ----- the maximum number of areas in the line plane

F [N] = (n-1) (2 * N-1) + 2 * N;

 

37. Recurrence world 7 ----- maximum number of closed curves in a plane

F [N] = f [n-1] + 2 * (n-1)

= Sqr (N)-N + 2;

38. Recursive world 8 ----- Number of triangle Splitting Methods for Convex Polygon

F [N] = C (2 * N-2, n-1) Div N;

For k-edge

F [k] = C (2 * K-4, K-2) Div (k-1); // (k> = 3)

 

39. Recurrence world 9 ----- Catalan series General Form

132

F [N] = C (2 k, k) Div (k + 1 );

 

40. Recurrence of Heaven and Earth 10 ----- lantern Layout

Ring dyeing in permutation and combination

F [N] = f [n-1] * (m-2) + F [N-2] * m-1); (F [1] = m; f [2] = m-1 );

 

41. Linear Dynamic Programming 4 ----- number finding

Linear scanning

Sum = F + G [J];

(If sum = aim then getout; If sum <aim theninc (I) else Inc (j );)

 

42. Linear Dynamic Planning 5 ----- invisible wings

Min = min {ABS (W/W [J]-gold )};

If w/w [J] <gold then Inc (I) else Inc (j );

 

43. Split Question 5 ----- maximum reward

F = max (F, F [J] + (sum [J]-sum) * I-t

 

44. Shortest-Floyd

F [I, j] = max (F [I, j], F [I, K] + F [K, J]);

Ans [Q [I, j, k] = ans [Q [I, j, k] + s [I, Q [I, j, k] * s [Q [I, j, k], J]/s [I, j];

 

45. Partitioning Problem 6 ----- small h hut

F [L, M, N] = f [l-x, S-1, n-k] + S (x, k );

 

46. counting problem 2 ----- the secret of meteorite (counting problem in arrangement and combination)

Ans [L1, L2, L3, d] = f [L1 + 1, L2, L3, D + 1]-f [L1 + 1, L2, L3, d];

F [L1, L2, L3, d] = sigma (F [O, P, Q, D-1] * f [l1-o, l2-p, l3-q, d]);

 

47. Linear Dynamic Planning ------ team-shaped

Twice F = max {f [J] + 1} + enumeration of central nodes

 

48. resource problems-clear budget plan: Dynamic Planning of flowers

F [I, j] = max (F [I, j], F [L, j-v [FB]-V [fa] + V * P + V [FB] * P [FB] + V [fa] * P [fa]);

 

49. resource problems-Chemical Industry packing personnel


50. Tree-based Dynamic Planning-happy gathering

F [I, 2] = max (F [I, 0], F [I, 1]);

F [I, 1] = sigma (F [t ^. Son, 0]);

F [I, 0] = sigma (F [t ^. Son, 3]);

 

51. Tree-based Dynamic Planning ----- Palace Guard

F [I, 2] = max (F [I, 0], F [I, 1]);

F [I, 1] = sigma (F [t ^. Son, 0]);

F [I, 0] = sigma (F [t ^. Son, 3]);

 

52. Recursive world-box and ball

F [I, 1] = 1;

F [I, j] = J * (F [I-1, J-1] + F [I-1, J]);

 

53. Dual dynamic planning-limited gene sequences

F = min {f [J] + 1}

G [C, I, j] = (G [A, I, j] and G [B, I, j]) or (g [C, I, j])

 

54. Maximum submatrix problem ----- residential space

F [I, j, k] = min (F [I-1, J, K], F [I, J-1, K]),

Min (F [I, j, k-1], F [I-1, J-1, K]), min (F [I-1, J, k-1], F [I, j-1, k-1]), f [I-1, J-1, k-1]) + 1;

 

55. Linear Dynamic Planning ------ schedule

F = max {f [J]} + P [I]; (E [J] <s)

 

56. Recurrence of Heaven and Earth ------ number of combinations

C [I, j] = C [I-1, J] + C [I-1, J-1]

C [I, 0] = 1

 

57. Tree-based Dynamic Planning ----- the K-value problem of a directed tree

F [I, R, K] = max {f [L, I, j] + F [R, I, k-j-1]}, F [f [L, R, j] + F [R, R, K-J] + W [I, R]}

 

58. Tree-based Dynamic Planning ----- ctsc 2001 Course Selection

F [I, j] = W (if I ε P) + F [L, K] + F [R, M-K] (0 ≤ k ≤ m) (IFL <> 0)

 

59. Linear Dynamic Planning-multiple history

F [I, j] = Sigma {f [I-K, J-1]} (if checked)

60. Backpack problems (+-1 backpack problems + backtracking) ----- ceoi1998 substract

F [I, j] = f [I-1, J-A] or F [I-1, J + A]

 

61. Linear Dynamic Programming (string) ----- the mystery of noi2000 Ancient City

F [I,] = min {f [I + Length (s),], F [I + Length (s),] + 1} f [I, 1, 2] = min {f [I + Length (s), 1, 2] + words [s], F [I + Length (s), 1, 2] + words [s]}

 

62. Linear Dynamic Programming-minimum number of words

F [I, j] = max {f [I, j], F [U-1, J-1] + L}

 

63. Linear Dynamic Planning ----- apio2007 Data Backup

State compression + state greedy dynamic planning after J * 2 states and J * 2 + 200 before each phase J

F = min (G [I-2] + S, F [I-1]);

 

64. Tree-based Dynamic Planning ----- apio2007 wind chimes

F = f [l] + F [R] + {1 (if C [l] <C [R])}

G = 1 (D [l] <> d [R]) 0 (d [l] = d [R])

G [l] = G [R] = 1 then halt;

 

65. Dynamic map planning ----- Noi 2005 adv19910

F [T, I, j] = max {f [T-1, I-DX [d [[T], J-dy [d [k] + 1], f [T-1, I, j];

 

66. Dynamic map planning ----- optimized Noi 2005adv19910

F [K, I, j] = max {f [k-1, I, p] + 1} J-B [k] <= P <= J;

 

67. Dynamic Target Planning ----- ceoi98 subtra

F [I, j] = f [I-1, J + A] or F [I-1, J-A]

 

68. Target Dynamic Planning-vijos 1037 dual-tower construction

F [value, Delta] = G [value + A, Delta + A] org [value, Delta-A]

 

69. Tree-based Dynamic Planning ----- cable TV network

F [I, p] = max (F [I, p], F [I, p-q] + F [J, q]-map [I, j])

Leaves> = P> = L, 1 <= q <= P;

 

70. Dynamic map planning ----- A vijos question

F [I, j] = min (F [I-1, J-1], F [I, J-1], F [I-1, J]);

 

71. Maximum submatrix problem ----- maximum field and Problem

F = max (F [I-1] + B, B); F [1] = B [1]

 

72. Maximum submatrix problem ----- maximum subcube Problem

Start of enumerating a group of edge I, which is compressed into matrix B [I, j] + = A [x, I, j]

Enumerate the other group of edges to create the largest submatrix.

 

73. Parentheses sequence ----- Linear Dynamic Planning

F [I, j] = min (F [I, j], F [I + 1, J-1] (ss [J] = "() "or (" [] "),

F [I + 1, J + 1] + 1 (s [J] = "(" or "["], F [I, j-1] + 1 (s [J] = ")" or "]")

 

74. Board Cutting-linear dynamic planning

F [K, X1, Y1, X2, y2] = min {f [k-1, X1, Y1, A, y2] + s [A + 1, Y1, X2, y2],

F [k-1, A + 1, Y1, X2, y2] + s [X1, Y1, A, y2]

Min {}}

 

75. Probability dynamic planning-cong Cong and Coco (noi2005)

X = P [p [I, j], J]

F [I, j] = (F [X, B [j, k] + F [x, J])/(L [J] + 1) + 1

F [I, I] = 0

F [x, J] = 1

 

76. Probability dynamic planning-kinship

F [a, B] = (F [A0, B] + P [a1, B])/2

F [I, I] = 1

F [I, j] = 0 (I, j does not have the same gene)

 

77. Linear Dynamic Planning-duel

F [I, j] = (F [I, j] and f [K, J]) and (E [I, K] ore [j, k]), I <k <j

 

78. Linear Dynamic Planning-dancer

F [x, y, K] = min (F [A [K], Y, k + 1] + W [X, a [k], F [x, A [K], k + 1] + W [Y, a [k])

 

79. Linear Dynamic Planning-building block games

F [I, A, B, K] = max (F [I, A + 1, B, K], F [I + 1, A + 1, A + 1, k'], F [I, A + 1, A + 1, k'])

 

80. Tree-based Dynamic Planning (dual record)-kids who skip school in noi2003

In simple terms, enumerate node I and the two farthest nodes J, K O (N ^ 2)

Each node records the maximum two values, and records the maximum value from which the adjacent node is passed. When traversing a child node, you only need to check whether the maximum value is transmitted from the child node. If yes, the value is greater than the maximum value. Otherwise, the value is the maximum value.

 

81. Tree-based Dynamic Planning (full Binary Tree) ----- noi2006 Network Billing

F [I, j, k] indicates that among all the users under the jurisdiction of node I, J users are a, on each ancestor U of I, if n [a]> N, it is marked as 0. Otherwise, it is marked as 1 and compressed into k in binary State. In this case, the minimum cost is

F [I, j, k] = min {f [L, U, K and (S <(I-1)] + W1, F [R, J-u, K and (S <(I-1)]}

 

82. Tree-based Dynamic Planning ----- ioi2005 River

F = max

 

83. Memory-based search ----- A question about vijos, forgot

F [pre, H, m] = Sigma {SDP (I, H + 1, m + I)} (pre <= I <= m + 1)

 

84. Dynamic State compression planning ----- APIO 2007 Zoo

F [I, K] = f [I-1, K and not (1 <4)] + newaddval

 

85. Tree-based Dynamic Planning-visit the library

F [I, j-c × 2] = max (F [L, K], F [R, J-c × 2-K])

 

86. String dynamic planning ----- Ural 1002 phone

If exist (copy (S, J, I-j) then f = min (F, F [J] + 1 );

 

87. Multi-Process Dynamic Planning ----- ceoi 2005 service

Min (F [I, j, k], F [I-1, J, K] + C [T [I-1], T])

Min (F [I, T [I-1], K], F [I-1, J, K] + C [J, T])

Min (F [I, j, t [I-1], F [I-1, J, K] + C [K, T])

 

88. Multi-Process Dynamic Planning ----- vijos1143 three-cell number

Max (F [I, J, K, L], F [I-1, J-R [M, 1], K-R [m, 2], l-R [M, 3]);

If (j = K) and (K = L) theninc (F [I, J, K, L], a [J, I-j]) else

If (j = k) Then Inc (F [I, J, K, L], a [J, I-j] + A [L, I-l]) else

If (k = L) theninc (F [I, J, K, L], a [J, I-j] + A [K, I-K]) else

If (j = L) theninc (F [I, J, K, L], a [J, I-j] + A [K, I-K]) else

INC (F [I, J, K, L], a [J, I-j] + A [K, I-K] + A [L, i-l]);

 

89. Dynamic Linear Planning ----- IOI 2000 Post Office Problems

F [I, j] = min (F [I, j], F [K, J-1] + d [k + 1, I]);

 

90. Linear Dynamic Planning-vijos 1198 best choice of subjects

If J-k> = 0 thenmin (F [I, j], F [I-1, J-K] + time (I, K ));

 

91. Backpack problems ----- usaco raucous rockers

Multiple backpacks are not allowed to store items repeatedly, but the order of items is limited.

F [I, j, k] indicates deciding on the I-th item and the J-th backpack. This backpack consumes K space.

F [I, j, k] = max (F [I-1, J, K], F [I-1, j, k-T] + P, F [I-1, J-1, maxtime-T])

 

92. multi-process dynamic planning-cruise Canada (ioi95, usaco)

D [I, j] = max {d [K, J] + 1 (a [K, I] & J <k <I), d [J, k] + 1 (a [I, j] & (k <j ))}.

F [I, j] indicates the number of cities that pass by when one person arrives at I and another person arrives at J. D [I, j] = d [J, I], so we limit I> J

Analysis status (I, j), which may be obtained when K reaches I in (k, j) (j <k <I) (method 1), or, in K) (k <j), if K exceeds J, I is obtained (method 2 ). However, it cannot be obtained when K in (I, k) (k <j) reaches J, because duplicate paths may occur. Even if there is no duplicate path, it can be obtained by (j, k) method 2, so it will not omit the time complexity O (N3)

 

93. Dynamic Planning ----- zoj cheese

F [I, j] = f [I-kk * ZL [U, 1], J-kk * ZL [U, 2] + A [I-kk * ZL [U, 1], J-kk * ZL [U, 2]

 

94. Dynamic Planning ----- Noi 2004 berry linear

F [I, 1] = s

F [I, j] = max {min {s-s [L-1]}, F [L-1, J-1]} (2 ≤ j ≤ k, j ≤ L ≤ I)

 

95. Dynamic Planning ----- Noi 2004 berry completely undirected graph

F [I, j] = f [I-1, J] or (j ≥w) and (F [I-1, J-W])

 

96. Dynamic Planning-optimization of quadrilateral inequality in stone merge

M [I, j] = max {M [I + 1, J], M [I, J-1]} + T [I, j]

 

97. Dynamic Planning ----- ceoi 2005 service

(K ≥ long, I ≥ 1) g [I, j, k] = max {G [I-1, j, k-long] + 1, G [I-1, J, k]}

(K <long, I ≥ 1) g [I, j, k] = max {G [I-1, J-1, T-long] + 1, G [I-1, J, k]}

(0 ≤ j ≤ m, 0 ≤ k <t) g [0, J, K] = 0;

Ans = G [n, m, 0].

State optimization: G [I, j] = min {G [I-1, J], G [I-1, J-1] + long}

(A, B) + long = (A', B ') is calculated as follows:

When B + long ≤ T: a' = A; B '= B + long;

When B + long> T: a' = a + 1; B '= long;

Planned boundary conditions:

When 0 ≤ I ≤ n, G [I, 0] = (0, 0)

 

98. Dynamic Planning ----- ahoi 2006 Treasury Channel

F [k] = max {f [k-1] + X [K, J]-X [K, I-1], X [K, J]-X [K, I-1]}

 

99. Dynamic Planning ----- travel

A)Travel plan with the least cost.

Set F indicates the minimum fee from the starting point to the first day of hotel I; G indicates the minimum fee from the starting point to the first day of hotel I, the minimum number of days required to meet the minimum cost. So:

F = f [x] + V, G = G [x] + 1

X:

1. x <I, and d-d [x] <= 800 (maximum daily trip ).

2. All t <I, d-d [T] <= 800 must meet the following requirements:

A. G [x] <G [T] (f [x] = f [T]) B. f [x] <F [T] (Other Cases)

F [0] = 0, G [0] = 0. Ans = f [n + 1], G [n + 1].

 

B). Travel plan with the least days.

The method is actually very similar to the first question.

G' indicates the minimum number of days from the start point to the first I hotel. F' indicates a day from the start point to the first I Hotel, the minimum fee required when the minimum number of days is met. So:

G' = G' [x] + 1, f' = f' [x] + V

X:

1. x <I, and d-d [x] <= 800 (maximum daily trip ).

2. All t <I, d-d [T] <= 800 must meet the following requirements:

F' [x] <F' [T] G' [x] = G' [T]

G' [x] <G' [T] Other Cases

F' [0] = 0, G' [0] = 0. Ans = f' [n + 1], G' [n + 1].

 

100. Dynamic Planning ----- Noi 2007 cash

Y = f [J]/(A [J] * C [J] + B [J]);

G = C [J] * y * A + y * B;

F = max (f, g)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.