## [dynamic programming] monotonic queue optimization DP

Monotonic queue optimization DP Maximum subsequence sum Source: https://www.acwing.com/problem/content/137/ Title Description Enter a length of n n An integer sequence of n, from which a length of no more than m ...

Posted by FlashbackJon on Sun, 07 Aug 2022 21:36:46 +0300

## [2020HDU multi calibration 6: interval dp] fragment numbers

HDU6831 : Fragrant numbers [difficulty] 3.5/103.5/103.5/10 In fact, the very simple interval dp But I didn't have time to think about it at that time// [title] Let SSS be an infinite string "1145141919" spliced together to become "114514191911451419114514191919..." "11451419114514191145141919 \ cdots" "1145141 ...

Posted by Nile on Wed, 25 May 2022 08:38:36 +0300

## Luogu P1896 non aggression (shape pressure dp)

Title Description In \ × Put \ (K \) kings on the chessboard of N \) so that they don't attack each other. How many placement schemes are there in total. The king can attack one grid in its upper, lower, left, lower, left, lower, right, upper and lower eight directions, a total of \ (8 \) grids. Input format There is only one line contain ...

Posted by dbomb101 on Mon, 23 May 2022 11:30:05 +0300

## Dynamic Programming II

Common dynamic programming problems (2) This article is reproduced at GitHub address: https://github.com/CyC2018/CS-Notes/ , only for personal review in the future. Integrated various data, invasion and deletion. Citation analysis: Content from official account article: https://mp.weixin.qq.com/s/lKQI0aS1MBwfPujC-m_zkA Use the dynamic ...

Posted by h123z on Sun, 22 May 2022 21:13:49 +0300

## Detailed explanation of monotonicity of decision-making

Necessary and sufficient conditions for monotonicity of decision making For two decision points, if at I, the large decision point is better than the small decision point, then at [i+1,n], the large decision point is better than the small decision point When proving, there is no need for mathematical proof, and it is enough to prove that the ...

Posted by Geof on Sun, 22 May 2022 09:04:14 +0300

## Digital statistics DP (338. Counting problem)

Digital statistics DP (338. Counting problem) Given two integers ∼ a ∼ and ∼ b, find the number of occurrences of 0 ∼ 9 in all numbers between ∼ a ∼ and ∼ b. For example, if a=1024 and b=1032, the total number of ， 9 ， between ， a ， and ， b ， is as follows: 1024 1025 1026 1027 1028 1029 1030 1031 1032 Among ...

Posted by artisticre on Fri, 20 May 2022 22:49:00 +0300

## Dynamic Programming: The Knapsack Problem - 2. The Complete Knapsack Model

maximum value minimum value complete knapsack problem analyze state representation v ( i ) v(i) v(i): the first i ...

## HDU - 1257 minimum interception system (dp three methods)

Title Link: [minimum interception system] General meaning: One shell of the interception system can reach any height to intercept enemy missiles, but this shell can not exceed the previous height in the future, that is, it can not intercept missiles higher than him again. Then give some missiles and ask how many interception systems are ne ...

Posted by mrheff on Tue, 17 May 2022 12:49:43 +0300

## Optimizing DP with Dij's idea

1, Content If the state transition equation of \ (DP \) is \ (f[i]=min\{f[i],\sum f[j]+k \} \) Then we can consider optimizing it with the idea of \ (Dij \) Because if the \ (f \) value of a point is the smallest, no other point can affect it Therefore, every time we take the smallest point from the heap and update other points 2, Examples 1. L ...

Posted by BenProl on Sat, 14 May 2022 19:28:38 +0300

## CF285E Positions in Permutations

What is different from others here is modulo addition and multiplication (I think this thing is very good, maybe a little faster? Solution First, it allows us to calculate the number of schemes, so we set an array \ (F(x) \) to represent the number of permutations whose perfect number is exactly \ (x \). From this familiar coincidence, we can s ...

Posted by winmastergames on Thu, 12 May 2022 11:41:57 +0300