当前位置:网站首页>【学习笔记】dp 状态与转移
【学习笔记】dp 状态与转移
2022-07-03 10:43:00 【仰望星空的蚂蚁】
Ehab and the Expected GCD Problem
思维还是慢了一步 。
observations + dp 。
这题难在 dp 阶段的设计 。 我们考虑从前往后向序列中填数 ,同时记录当前前缀 gcd 状态。
dp[i][j][k] 表示考虑了前 i 个数,前缀 gcd = 2 j 3 k ( k = 0 / 1 ) \gcd=2^\text{j}3^\text{k}(k=0/1) gcd=2j3k(k=0/1) 。转移是巧妙的 。(乘法原理)
Three Servers
看完题意我是 joker …
简单的背包问题可以让你怀疑人生 …
可达性 dp -> 最优性 dp
observations + dp
同为可达性 dp :https://blog.csdn.net/cqbzlydd/article/details/124870640?spm=1001.2014.3001.5501
Hero meet devil
毋宁是状压好题 。
observations + dp
Min Product Sum
dp(x)
数学(v)
干瞪眼大法 …
我怎么看不懂题解啊
Salvage Robots
大受震撼 …
强行构造状态和dp阶段 …
膜拜 idsy …
考虑中间有一个安全区域 … 四周为危险区域 …
考虑将安全区域拖动,这样危险区域中的一些 robot 会被甩出去 …
设 d p [ a ] [ b ] [ c ] [ d ] dp[a][b][c][d] dp[a][b][c][d] 表示安全区域左上角为 ( a , b ) (a,b) (a,b),右下角为 ( c , d ) (c,d) (c,d) ,在危险区域能救起的 robot 的最大数量 。
至于转移,预处理 Up[i][l][x] 表示第 i 列 [1,l] 的 robot 向上移动不超过 x 步能到达 E 的数量
上下左右四个方向类似 。
转移时考虑这个安全区域往里缩 :
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]
上下左右四个方向同理 。
答案 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) 。因为最后一个 robot 一定是安全的 。
这题的状态和阶段太难想到了 。毋宁称之为构造dp题 。
Prefix Median
AGCAGCAGC
边栏推荐
- 项目管理精华读书笔记(六)
- C language two-dimensional array
- How to get started embedded future development direction of embedded
- Internet socket (non) blocking write/read n bytes
- The world's most popular font editor FontCreator tool
- One hot code
- Résumé des questions d'entrevue (2) Modèle io, ensemble, principe NiO, pénétration du cache, avalanche de rupture
- 程序员的创业陷阱:接私活
- C语言二维数组
- [vtk] source code interpretation of vtkpolydatatoimagestencil
猜你喜欢
Event preview | the live broadcast industry "rolled in" to drive new data growth points with product power
Cadence background color setting
ASP.NET-酒店管理系統
ASP. Net hotel management system
Application of high-precision indoor positioning technology in safety management of smart factory
Use typora to draw flow chart, sequence diagram, sequence diagram, Gantt chart, etc. for detailed explanation
软件测试周刊(第78期):你对未来越有信心,你对现在越有耐心。
Mmc5603nj geomagnetic sensor (Compass example)
Incremental database backup - DB incr DB full
Understand go language context in one article
随机推荐
How to: configure ClickOnce trust prompt behavior
Touch and screen automatic rotation debugging
Unique in the industry! Fada electronic contract is on the list of 36 krypton hard core technology enterprises
Google Earth engine (GEE) -- when we use the front and back images to make up for the interpolation effect, what if there is no effect?
Gut | Yu Jun group of the Chinese University of Hong Kong revealed that smoking changes intestinal flora and promotes colorectal cancer (do not smoke)
2022-07-02: what is the output of the following go language code? A: Compilation error; B:Panic; C:NaN。 package main import “fmt“ func mai
一文搞懂Go语言Context
Static library vs shared library
Empire CMS no thumbnail smart tag (e:loop) two ways to judge whether there is a titlepic
How to become a senior digital IC Design Engineer (1-5) Verilog coding syntax: operand
用了这么久线程池,你真的知道如何合理配置线程数吗?
Execute kubectl on Tencent cloud container service node
phpcms 提示信息页面跳转showmessage
1. Hal driven development
Internet socket (non) blocking write/read n bytes
After using the thread pool for so long, do you really know how to reasonably configure the number of threads?
鸿蒙第四次培训
Abandon the Internet after 00: don't want to enter a big factory after graduation, but go to the most fashionable Web3
MATLAB extrait les données numériques d'un fichier txt irrégulier (simple et pratique)
大厂技术专家:工程师如何提升沟通能力?