NOIp2019 before dp thematic explanations 1.0

Large luogu1373 small a and uim of escape : violence dp it is referred to \ (dp_ {i, j, p, q, 0/1} \) represents the current in the \ ((I, J) \) , the first / second individual digital-analog \ (K +. 1 \) , and the current turn of the first / second number of individual programs. Optimization of statistical considerations, then the answer \ (p = q \) the number of programs you can put the two-dimensional difference credited directly save both time \ (O (NMK) \)

luogu1220 lights off : turn off all the notes each other must be a continuum, and the person must stand on both ends of the section, then remember \ (dp_ {i, j, 0/1} \) represents the interval has been switched off \ ([i, j] \ ) lamp, standing leftmost / rightmost minimum cost, the pretreatment takes every second outer remove all the lamps of each section, the total time \ (O (n ^ 2)\)

luogu1156 spam trap : remember \ (dp_ {i, j} \) before the representation \ (i \) of garbage, to the current pile height \ (j \) the maximum amount of blood, then transfer it to consider the current bunch is eaten or pile up, solving the answers, to find \ ({i, m} dp_ \) has a value of time \ (i \) minimum, otherwise \ (dp_ {i, J} \) + section \ (i \) the maximum time of appearance of garbage

luogu1273 cable networks : tree knapsack problem template, the user spending seen as positive, each side regarded as negative direct cost backpack, time is \ (O (the n-^ 2) \) (as if there is a log do not remember it anyway, 2500 can live on the right)

luogu1169 [ZJOI2007] board production : hanging line method template title, but you can also write stack monotonous, time complexity \ (O (nm) \)

luogu2577 [ZJOI2005] Lunch : a comparison is obvious greedy meal we first consider the length to the front, followed by a similar backpack design condition, denoted (dp_ {i, j} \ ) \ former represents \ (I \) the individual has completed, where the first group Dafan time \ (j \) minimum meal time, still enumerate the current people on which group transferred

luogu2051 [AHOI2009] Chinese Chess : problem is equivalent to each row and each column put two guns no more than a few programs, and we moved in rows according to routine, and in order to take into account the conditions of the column, we write \ (dp_ {i, j , k} \) representing the forward \ (I \) line, with a \ (J \) listed \ (1 \) a gun with \ (K \) lists the number two embodiment of the gun, the transfer account of the \ ( I \) row 0/1/2 put a gun, for each case there is also divided it in two pieces 0/1/2 columns time \ (O (nm ^ 2) \)

Guess you like

Origin www.cnblogs.com/encodetalker/p/11330191.html