当前位置:网站首页>[learning notes] DP status and transfer
[learning notes] DP status and transfer
2022-07-03 11:54:00 【Ants looking up at the starry sky】
Ehab and the Expected GCD Problem
Thinking is still a step slow .
observations + dp .
This problem is difficult dp Stage design . Let's consider filling in the sequence from front to back , At the same time, record the current prefix gcd state .
dp[i][j][k] Before considering i Number , Prefix gcd = 2 j 3 k ( k = 0 / 1 ) \gcd=2^\text{j}3^\text{k}(k=0/1) gcd=2j3k(k=0/1) . The transfer is ingenious .( Multiplication principle )
Three Servers
After reading the title, I am joker …
Simple knapsack problems can make you doubt life …
Accessibility dp -> Optimality dp
observations + dp
Both are accessibility dp :https://blog.csdn.net/cqbzlydd/article/details/124870640?spm=1001.2014.3001.5501
Hero meet devil
It's better to press the question .
observations + dp
Min Product Sum
dp(x)
mathematics (v)
Dry stare method …
Why can't I understand the solution
Salvage Robots
Shocked …
Forcibly construct the state and dp Stage …
Worship idsy …
Consider a safe area in the middle … There are dangerous areas around …
Consider dragging the safety zone , Some of these dangerous areas robot Will be thrown out …
set up d p [ a ] [ b ] [ c ] [ d ] dp[a][b][c][d] dp[a][b][c][d] Indicates that the upper left corner of the safety area is ( a , b ) (a,b) (a,b), The lower right corner is ( c , d ) (c,d) (c,d) , It can be saved in a dangerous area robot Maximum number of .
As for transfer , Preprocessing Up[i][l][x] It means the first one i Column [1,l] Of robot Move up no more than x Step by step E The number of
Up, down, left and right directions are similar .
When transferring, consider the safety zone to shrink inward :
d p [ a ] [ b ] [ c ] [ d ] + ? → d p [ a ] [ b + 1 ] [ c ] [ d ] dp[a][b][c][d]+?\to dp[a][b+1][c][d] dp[a][b][c][d]+?→dp[a][b+1][c][d]
The four directions up, down, left and right are the same .
answer max ( d p [ i ] [ j ] [ i ] [ j ] + 1 ) ( s [ i ] [ j ] = o ) \max(dp[i][j][i][j]+1)(s[i][j]=o) max(dp[i][j][i][j]+1)(s[i][j]=o) . Because the last one robot It must be safe .
The state and stage of this question are too difficult to think of . Rather call it structure dp topic .
Prefix Median
AGCAGCAGC
边栏推荐
- Nestjs configuration service, configuring cookies and sessions
- STL教程9-容器元素深拷贝和浅拷贝问题
- Numpy np. Max and np Maximum implements the relu function
- Based on MCU, how to realize OTA differential upgrade with zero code and no development?
- Understand go language context in one article
- Vulnhub narak
- 【mysql官方文档】死锁
- The tutor put forward 20 pieces of advice to help graduate students successfully complete their studies: first, don't plan to take a vacation
- 金额计算用 BigDecimal 就万无一失了?看看这五个坑吧~~
- 银泰百货点燃城市“夜经济”
猜你喜欢
DS90UB949
MCDF实验1
Hongmeng third training (project training)
vulnhub之momentum
Software testing weekly (issue 78): the more confident you are about the future, the more patient you are about the present.
Qt OpenGL 纹理贴图
Xml的(DTD,xml解析,xml建模)
STL Tutorial 9 deep copy and shallow copy of container elements
"Jianzhi offer 04" two-dimensional array search
Introduction to the implementation principle of rxjs observable filter operator
随机推荐
同事写了一个责任链模式,bug无数...
R language uses the aggregate function to calculate the mean value (sum) of dataframe data grouping aggregation without setting na The result of RM calculation. If the group contains the missing value
Mysql根据时间搜索常用方法整理
phpcms 提示信息頁面跳轉showmessage
Kibana~Kibana的安装和配置
Excel quick cross table copy and paste
解决msvcp120d.dll和msvcr120d.dll缺失
牛牛的组队竞赛
Niuniu's team competition
Software testing weekly (issue 78): the more confident you are about the future, the more patient you are about the present.
OPenGL 基本知识(根据自己理解整理)
vulnhub之pyexp
VS2015的下载地址和安装教程
抓包整理外篇fiddler———— 会话栏与过滤器[二]
XML (DTD, XML parsing, XML modeling)
Go language to realize static server
Dynamic programming (interval DP)
Keepalived中Master和Backup角色选举策略
STL教程9-容器元素深拷贝和浅拷贝问题
小鹏 P7 撞护栏安全气囊未弹出,官方回应称撞击力度未达到弹出要求