POJ Dynamic Programming Topic list and summary

Source: Internet
Author: User
Tags integer division

This article reproduces others, hoped oneself can finish these questions!

1.POJ Dynamic Planning Topic list

Easy: 1018, 1050, 1083, 1088, 1125, 1143, 1157, 1163, 1178, 1179, 1189, 1208, 1276,1322, 1414, 1456, 1458, 1609, 1644, 1664, 1690, 1699, 1740 (game), 1742, 1887, 1926 (Markov matrix, Balance), 1936, 1952, 1953, 1958, 1959, 1962, 1975, 1989, 2018,2029, 2039, 2063, 2081, 2082, 2181, 2184, 2192, 2231, 2279, 2329, 2336, 2346,2353, 2355, 2356, 2385, 2392, 2424,

Not easy: 1019, 1037, 1080, 1112, 1141, 1170, 1192, 1239, 1655,1695, 1707, 1733 (interval subtraction plus set), 1737, 1837, 1850, 1920 (Reinforced Han Rota), 1934 (full The longest common sub-sequence), 1937 (Computational Geometry), 1964 (Maximum rectangular area, O (n) algorithm), 2138, 2151, 2161, 2178,

Recommended: 1015, 1635, 1636 (very good), 1671, 1682, 1692 (optimized), 1704, 1717, 1722, 1726, 1732, 1770, 1821, 1853, 1949,2019, 2127, 2176, 222 8, 2287, 2342, 2374, 2378, 2384, 2411

 1015 Jury compromise 1029 False Coin 1036Gangsters 1037 A Decorative Fence 1038 Bugs Integrated, Inc. 1042 Gone Fish ing1050 to the Max 1062  expensive dowry  1074 Parallel expectations Human Gene functions1088  ski 1093 formatting Te XT 1112 Team them up! 1141 Bracketssequence 1143 number Game 1157 LITTLE Shop of FLOWERS 1159 palindrome 1160 postoffice 1163 the Triangle 1170 Shopping offers 1178 Camelot 1179 Polygon 1180Batch scheduling 1185  artillery positions  1187  Meteorite Secrets  1189  Nails and pellets  1191  Checkerboard segmentation  1192  Optimal Connectivity subset  1208 the Blocks problem 1239 increasing sequences 1240pre-post-erous! 1276 Cash machine 1293 Duty free shop 1322 chocolate 1323 gameprediction 1338 Ugly Numbers 1390 Blocks 1414 Life Line 1432 Decoding morsesequences 1456 supermarket 1458 Common subsequence 1475 pushing Boxes 1485 fastfood 1505 Copying Books 1513 Scheduling Lectures 1579 Function Run fun 1609Tiling up Blocks 1631 bridging signals 2  min +dpnlogn 1633 Gladiators 163 5 SubwayTree Systems 1636 Prison rearrangement 1644To bet or not-to-bet 1649 market place 1651 multiplication Puzzle 1655Balancing ACT 1661 help Jimmy 1664  put Apple  1671 rhyme schemes 1682 clans on the Three Gorges 1690 (Your) (term) ((Project)) 16 Painting A Board 1692 crossed matchings 1695Magazine Delivery 1699 best Sequence 1704 Georgia and Bob 1707 Sum of power s1712 Flying Stars 1714 the Cave 1717 dominoes 1718 River Crossing 1722 SUBTRACT1726 Tango Tango insurrection 1732 Phone n Umbers 1733 Parity game 1737Connected Graph 1740 A New Stone game 1742 Coins P 1745 divisibility 1770Special Experiment 17 Elevator stopping Plan 1776 Task sequences 1821 Fence1837 Balance 1848 Tree 1850 Code 1853 Cat 1874 trade on Verweggist An 1887Testing the CATCHER 1889 package Pricing 1920x1080 Towers of Hanoi 1926 Pollution1934 trip 1936 all in all 1937 Balanced Food 1946 Cow Cycling 1947 rebuildingroads 1949 Chores 1952 buy Low, buy LOWER 1953 World Cup Noise 1958 Strangetowers of Hanoi 1959 Darts 1962 COrporative Network 1964 City Game 1975 Medianweight Bead 1989 the Cow lineup 2018 Best Cow Fences 2019 cornfields 2029 Get Many persimmon Trees 2033 Alphacode 2039 to and Fro 2047 Concert hallscheduling 2063 Investment 2081 Recaman ' s Sequence 20 Terrible sets 2084 gameof Connections 2127 greatest Common increasing subsequence 2138 travel Games2151 Check the Diffi Culty of problems 2152 fire 2161 Chandelier 2176 Folding2178 Heroes of Might and Magic 2181 jumping cows 2184 Cow Exhibiti On 2192Zipper 2193 Lenny ' s Lucky Lotto Lists 2228 naptime 2231 Moo Volume 2279 Mr.young ' s picture permutations 2287 Tian J I--the Horse Racing 2288 Islands andbridges 2292 Optimal Keypad 2329 Nearest number-2 2336 Ferry Loading II 2342Annive Rsary Party 2346 Lucky Tickets 2353 Ministry 2355 Railway Tickets 2356Find a multiple 2374 Fence obstacle Course 2378 Tree Cutting 2384 Hardersokoban problem 2385 Apple catching 2386 Lake counting 2392 Space Elevator 2397Spiderman 2411 MONDRIAA N ' s Dream 2414 phylogeneTic Trees inherited 2424 Flo ' srestaurant 2430 Lazy cows 2915 Zuma 3017 Cut the Sequence 3028 shoot-out 3124The Bookcase 31 Manhattan Wiring 3345 bribing FIPA 3375 Network Connection3420 Quad Tiling? http://www.gccfeli.cn/?cat=5

[2] Summary of dynamic programming methods

1. By type of state

Write in front:

From the state type, it does not mean that a problem belongs to only one class. Actually a class is just a representation of a state. Several methods can be combined into one state to solve the problem.

1.1. Number (length) Dynamic Planning Generality Summary:

The state of this class is the basis of the foundation, most of the dynamic planning is to use it, to become a dimension. In general, there are two kinds of numbered states:

1. State (i) represents a state in which the decision of the first I element is composed.

2, the State (i) is used to the first element, and other elements between 1 to i-1, the decision to form a state.

Item Bank

A) the longest non-descending subsequence takes a tuple (i) as the state, representing the longest sequence of I as the last point of the sequence. So it's easy to think O (N2) algorithm. But the subject can be organized in a reasonable state, introduce a monotone auxiliary array, and use monotone binary search to optimize to O (NLOGN). The optimization is described in the optimization chapter. Some problems can be ordered to the data, conversion cost problem.

Application: Interceptor Missile (NOIP99 Advance 1) is the original problem. Beautiful people (sgu199), to order the data: one of the right as the first keyword does not fall in the arrangement, the other right as the second keyword does not rise. Segment (Ural 107), the left endpoint of the line segment is ordered.

b) The LCS State (I,J), which represents the first bit of the 1th string, matches the first J bit of the 2nd string and gets the longest string. If there are multiple strings to LCS, then Garvey, that is, a few strings on several dimensions. I also put the problem in the path. c) Flower shop window arrangement (IOI99) See path problem.

1.2. General summary of interval dynamic programming:

This kind of problem and the next chapter of the division of the decision-making point of intersection of the disorder is relatively large (accounting for 30% of this type of problem). Item Bank

A) Classification of stones

b) template matching (ceoi01,patten)

The special place of the problem is that the value of the state is a set rather than a number.

    C)        non-exploded encoding (Acmworld Final 2002) d) Electric Path (ural1143) e)   Post Office (ioi2000day2 1)   If the idea of state representation from i  village can belong to which post office, no optimal substructure. Change One Direction: k  a Post Office can "control" a range of villages [I,j]. So the equation is obvious: f (k,i,j) =min{f (k-1,p,i-1) +w (I,J)} (k-1<=p<=i-1) S (i)   The distance from the village i  to the origin.  w (I,J) =min{k| sum{| S (k)-S (P) |} (I<=P<=J)} (i<=k<=j)   Find the best post office point between [I,j]. But you can find  sum{|. S (k)-S (P) | is monotonous, so take the median number. That is, the value range of k  in the upper-middle is only  floor ((I+J)/2), Ceil ((I+J)/2) two. Floor is under rounding. ceil  is the rounding up. This reduces each transfer time to O (1). Notice that the interval is continuous, i.e. (p,i-1)   and (I, J)    i-1, i  is continuous, so space can be reduced to dimension: F (i,j) represents the optimal value of i  a former post office to the former j  village.  f (i,j) =min{f (i-1,p-1) +w (P,J)} (I-1<=p<=j-1} e (i,j)   is P when f (i,j) reaches the optimal value. By proving the quadrilateral inequalities, I get E (i,j) <=e (i , j+1) <=e (i+1,j+1)   The number of decisions is an order of magnitude less.

1.3. Coordinate dynamic programming generality summary: After some problems, the state is composed of coordinate dimension and other dimension. The intersection of this class with the partitioning problem (which is the division of 2-dimensional or multidimensional coordinate systems) and the path problem is the majority of the problems. Question Bank: a) Checkerboard segmentation (NOI99 4) is mainly the formula deformation, the formula after deformation is easy to see the equation. A state is a 2-coordinate 4-tuple (x1,y1) (X2,y2) that represents a sub-chessboard. This is a bit like the previous interval dynamic planning, but it is 1-dimensional to 2-dimensional. See the path problem later.

1.4. Axis Dynamic Planning General Summary: Question Bank: a) 01 Backpack application: Packing problem (NOIP01 Trade 4) is the original question. The value of the coin division can take advantage of the nature of the equation, the space reduced 1 d. The value of the currency can be duplicated (pku1742, problem F Loutiancheng ' s Contest in POJ). Use the left and right method to speed up the position. Add an attribute last to the status, and record the remaining number of coins available in the same currency (using the current transfer is the only precursor feature). b) Take match question (sgu153 Playing with matches) c) Stone Pile (Ural1005stone Pile) d) road Patrol (CTSC2000)

1.5.5. Tree-type Dynamic Programming General summary:

1) The Order of dynamic programming is generally in accordance with the order of the post-sequence traversal, that is, the processing of the son and then processing the current node, only conform to the nature of the tree substructure.

2) Multi-fork tree to two-fork tree because to allocate additional dimensions to each node, assigning additional dimensions is a partitioning problem, and if it is assigned to each son node by the current node, it becomes an integer division problem, O (N2). So we need to convert the multi-fork tree to a two-fork tree, so that we can only make a decision on the distribution of the current point in a dynamically planned way, O (n).

3) Add the current point of the selected or not selected constant dimension and this dimension solves the problem of AfterEffect.

4) The technique of turning the edge information into a tree splits the read-in edge into 2 edges, linking the 2 border (that is, finding an edge and the number of the other side). Use forward to the star representation of the Edge (ordered by the starting point), later with the edge of the time, with a side hit not to use the flag, will also be associated with the edge hit unavailable flag. This ensures that the time for O (n) is processed, and that it is very convenient for the parent node to find a son.

5) complexity tree Dynamic programming complexity is basically O (n); If there is an additional dimension m, it is O (nm).

Item Bank

A) Course selection (ctsc97-3) The multi-fork tree is converted to a two-fork tree because of the number of courses to be allocated.

b) Greedy nine-headed dragon (noi02-3) If the number of small heads is greater than 1, let the different small head eat a branch of the 2 endpoints. In this way, the problem is translated into: The additional dimension is the number of big head eat, the current point by the big Head eat the constant dimension of dynamic planning. Because of the partitioning problem, the multi-fork tree is converted to a two-fork tree.

c) The centroid of the tree (sgu134 centroid) gives a tree with no right edge, so that when this point is removed, the remaining maximum number of vertices of the largest connected sub-graph is minimized.

d) Find the nearest point in the tree in the farthest distance. Give a tree with the right edge, and seek the points in the tree, making this point the farthest distance from the other nodes in the tree. Computer Network (sgu149) computer Net (ural1056)

1.6. Aggregation dynamic programming (state compression) General summary:

1) data specificity the data given in one or several dimensions generally have a relatively small range (can enumerate a class of States). The state of an enumeration is a collection.

2) encoding because of the number of elements in the set of uncertainties or large range, directly open the array, not good index array (programming complexity is too high), so the collection is encoded. Encodes the State (collection) of the enumeration, taking advantage of the enumerable nature of the data. Generally speaking, the range of code values to be very small (as far as possible to exclude useless code values, such as artillery: the current lattice and the presence of artillery in the case is illegal, can be excluded). Specify the code value of the code to represent the meaning, to try to set a good maintenance code value. (such as artillery: the current lattice exists artillery 2, the upper lattice exists artillery 1.) This way the next level of planning, as long as the code value-1 can be. Sometimes it is possible to use the sequential programming of coding directly, because the coding is now the order of extension and complement. For example, the TSP problem is that the encoded value of the precursor of the state of the currently selected point collection must be smaller than the current encoded value.

3) State compression on the placement of the finite stage, the Walking situation code (which is also placed in the set or set of walking route), such a code, also some people say: "state compression." This kind of question takes "the artillery position" as the typical, expands.

Item Bank

A) shopping (ioi95-2) each item is encoded in 5. (5 is the upper limit for each item) since the upper limit of the number of items is 5, smaller, it can also be directly opened array storage.

b) Roger game Mission One (CTSC98 Day2 4) a cube in a square in the state of only 24, and can be represented by the top and front, so that the 3-dimensional state (x,y,p) can be resolved, p is 1 to 24 of the state of one.

c) tsp to observe the TSP search process: for (x in not selected points) tsp (x) is the last node of the current road is X, now to select the next node y, and Y is in the collection of not selected points. If no point or set of selected points has been determined, the aftereffect is eliminated. can be DP. The state is the set of selected points for the current path (including i), and the last node of the current path is I. The 2-tuple (x,i) is the shortest length of the set X to node I that has been selected. Encode the X. Note: The problem is not brought from the NP class to the P class because of dynamic planning. Application: DNA Laboratory (Problem B,tu-darmstadt programmingcontest 2004) The overlapping parts of each string are calculated, the problem can be specifically into the TSP, but to output the smallest dictionary order, you need to pay attention to the DP sequence. There are specific reports.

d) Artillery positions are very classic, see the report. Application: Another chocolate Maniac (sgu132) The most value of the artillery-like approach is simply to find the minimum, troublesome point. Hardwood Floor (sgu131) is similar to the artillery practice of statistics Little Knights (sgu225) similar to the artillery practice of statistics, the data volume is too great for the Const Little Kings (sgu223) Similar artillery practices of the Statistics Bugs Company ( CEOI 2002) The maximum value of an artillery-like approach

1.7. Using the dynamic programming idea to find the most value, the number (cyclic variable) Iteration General summary: To use some of the last operation "left" loop variable as the current loop boundary, mainly to find a decision order, make it set up.

Item Bank

A) cow's bath B) communication The System to order the data, from the large to the small enumeration bandwidth, each time can take advantage of the results of the last processing min, to decide the current state. Called an iteration, or is a dynamic plan. (zju1409, Problem C Tehran 2002 Iran Nationwide internetprogramming Contest)

1.8. Memory Search Question Bank

A) Magic Trick (Problem G, Tu-darmstadt programmingcontest 2004)

2. Divide by transfer mode

2.1. Existence of recursion

1) 01 Statistics (CTSC99 1)

2) Cattleya number Circle (sgu130) 3) Eagle Egg

2.2. Ask for a series of split (merge) points (partitioning problems)

2.2.1. Summary of the order of split points in decision making:

A) The order of the points of each decision is ordered, that is, the order of the decision to output the number of the segmentation point, the number is ordered, to meet the number of split points in ascending order.

b) The general form of the equation F (n,m) =optimize{f (k,m-1) +w (K+1,n)} (N,m) represents the optimal value from 1 to n points divided into m parts; K is the split point of the decision, that is, the section M is k+1 to n; here optimize can be max,min.

Item Bank

A) integer division is often applied in assigning a right to a certain small block, such as: a large heap of pebbles into a small heap, a small heap can be empty, large piles to be divided. It is sometimes applied in tree-type dynamic programming (binary-to-fork).

b) the product maximum (NOIP00 Advance 2) is done according to the general equation above.

2.2.2. Summary of Split-point disorder in decision-making:

A) The number of points in each decision is unordered, that is, to output the number of the split point in the recursive order of the decision, the number is unordered.

b) Equation general form F (i,j) =optimize{f (i,k-1) +f (k+1,j)}+w (i,j) (I,J) represents the optimal value of a split point K from the I to J Range, the sub-problem is the split point to the left (i,k-1) and to the right (K+1,J) The optimal value for the range of points; here optimize can be max,min. The equation is similar to the nature of a 2-fork tree.

c) Quadrilateral inequalities such problems, some can be optimized for quadrilateral inequalities. See optimization Chapter

。 Question Bank: A) Stone merger (NOI95 2) classic, see the report. The use of quadrilateral inequalities can be optimized to O (N2), in fact, the data structure of similar heap in O (NLOGN) time to complete, but this is not dynamic planning. Application: A) constructs the optimal binary sort tree (CTSC96 2) b) Polygon (IOI9 This value of the positive and negative number processing to note that multiplication, because of the addition of symbols, so that the original positive optimal solution, a negative. c) Add two fork tree (NOIP03 Advance 3) equation is the general formula, transfer function: W (i,j) =sum (i,k-1) *sum (k+1,j) +d (k). Because W (i,j) does not satisfy convex monotonicity, it cannot be optimized with quadrilateral inequalities. d) Bracket sequence (Problem B, NEERC 2001) The dividing point of this problem is not an element, but a line between elements. The main way of thinking is from the recursive definition.

2.3. Generic summary of PATH issues:

A) the direction of travel determines the stage has a specified source and end point. Each walk direction has certain rules, so that the origin to the end of all paths to form a non-circular directed graph.

b) multi-source or multi-sinks when multi-source or multi-sinks, should be Garvey, so that each source, there is a path of the state and corresponding. If there is a grid class problem with n sources, it is often turned (x1,y1) (x2,y2) ... (Xn,yn). But the source is too many, space is not allowed, can reduce the problem to turn into network flow problem.

c) Two-way dynamic programming due to the provisions of the source and end point, can be bidirectional dynamic planning, but to consider the effect is not good, theoretically 1/2 less than the original, but sometimes because the state can be used for decision less, the effect is good.

d) Decision-making sparsity is the so-called walk, if for a state, its predecessor or successor number is very few (from the non-circular to the graph angle, is the degree or the degree of less), called the decision sparse.

E) State sparsity is that many states are useless, such as the arranged LCS, the state is 2 dimensions (x, y), but for an x only one y is valid. So essentially the number of States is linear. Some of the skills of this kind of things more, in the question bank specific description.

Item Bank

A) Check number (NOIP00 advance 4) (X1,Y1) (x2,y2) diagonal space optimization B) Flower shop window layout (IOI99) I have a little makeover on the subject: If the vase is disorderly, how to do it, order refers to: for bouquet i< Bouquet J, bouquet I corresponding vase number < Bouquet J corresponds to the vase number. Then this is a NP problem, which can be solved by the dynamic programming based on state compression.

3. Optimization of dynamic programming

3.1. Iteration

3.2. Quadrilateral

3.3. convexity optimization

POJ Dynamic Programming Topic list and summary

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.