随笔分类 - 动态规划--就是DP
摘要:题面 "链接" Sol 模拟退火 再做数列上的$DP$ cpp include define RG register define IL inline define Fill(a, b) memset(a, b, sizeof(a)) using namespace std; typedef lon
阅读全文
摘要:题面 "Bzoj" Sol 简单$DP$ cpp include define IL inline define RG register define Fill(a, b) memset(a, b, sizeof(a)) using namespace std; typedef long long
阅读全文
摘要:题面 "传送门" Sol 先设一个套路的状态:$f[i][j]$表示到第$i$个人,有$j$对冲突 但是我们不能确定$i 1$,所以不好决策i的位置 所以再加一维$0/1$,$f[0/1][i][j]$表示$i$和$i 1$是否有冲突 每枚举一个人,我们就要把它插入到之前的队列中 转移: $f[0]
阅读全文
摘要:题面 "传送门" Sol1 因为每种油漆的数量是有限的 并且每种油漆是没有优先级的 直接设状态$f[lst][a][b][c][d][e]$表示有$a$个可以涂一次,$b$个可以涂两次......上次涂的是可以涂$lst$次的 记搜+乘法原理即可 cpp include define RG regi
阅读全文
摘要:题面 "传送门" Sol 先求出最长上升序列,倒着求,然后贪心的往后选,选满足的 求最长上升序列我用的是树状数组
阅读全文
摘要:题面 "传送门" Sol 两种情况 第一种就是类似$ 000 000 (0表示选)$,这个可以DP 设$h[0/1/2/3][i]$表示到第$i$位的状态: $0$:表示还没选 $1$:表示当前在第一段 $2$:表示选完了第一段 $3$:表示当前在第二段 第二种就是类似$000 000 000$,这
阅读全文
摘要:题面 "传送门" Sol 就相当于从$x_0$开始左右横走,显然可以设$f[0/1][i][j]$表示左到$i$右到$j$,当前在左/右的代价 但是不好记转移代价,因为不知道时间 那么可以把它变成最小损失,每次转移就是加上两边没走的蛋降落的损失,最后用总代价相减即可
阅读全文
摘要:斜率优化 # include <stdio.h> # include <stdlib.h> # include <iostream> # include <string.h> # include <algorithm> # define IL inline # define RG register
阅读全文
摘要:斜率优化 # include <stdio.h> # include <stdlib.h> # include <iostream> # include <string.h> # include <algorithm> # define IL inline # define RG register
阅读全文
摘要:斜率优化 # include <stdio.h> # include <stdlib.h> # include <iostream> # include <string.h> # include <algorithm> # define Sqr(x) (1LL * (x) * (x)) # defi
阅读全文
摘要:斜率优化 # include <stdio.h> # include <stdlib.h> # include <iostream> # include <string.h> # include <algorithm> # define IL inline # define RG register
阅读全文
摘要:斜率优化 # include <stdio.h> # include <stdlib.h> # include <iostream> # include <string.h> # include <algorithm> # define Sqr(x) (1LL * (x) * (x)) # defi
阅读全文
摘要:觉得题目水的离开 觉得普及组垃圾的请离开 不知道 DFS 和 DP 的请离开 不屑的大佬请离开 ……. 感谢您贡献的访问量 ————————————————华丽的分割线 ———————————————— 先看题面: 题目描述 给出如下定义: 子矩阵:从一个矩阵当中选取某些行和某些列交叉位置所组成的新
阅读全文

浙公网安备 33010602011771号