![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
DP
一条很咸的鱼
这个作者很懒,什么都没留下…
展开
-
cf Round 600 Antenna Coverage dp
Antenna Coverage给定若n个区间,每次操作可以使一个区间左右拓宽1,求最小操作次数使得区间[1,m]均被覆盖.考虑dp:dp[i]=区间[i,m]均被覆盖的最小花费转移:dp[i]=dp[i+1]dp[i]=dp[i+1]dp[i]=dp[i+1],如果[1,i][1,i][1,i]被原始区间覆盖.否则,p=l−i,dp[i]=min(p+dp[r+p+1]),(l>...原创 2019-11-17 23:07:35 · 155 阅读 · 0 评论 -
单调队列dp
P3084 [USACO13OPEN]照片Photo农夫约翰决定给站在一条线上的N(1 <= N <= 200,000)头奶牛制作一张全家福照片,N头奶牛编号1到N。于是约翰拍摄了M(1 <= M <= 100,000)张照片,每张照片都覆盖了连续一段奶牛:第i张照片中包含了编号a_i 到 b_i的奶牛。但是这些照片不一定把每一只奶牛都拍了进去。在拍完照片后,约翰发现...原创 2019-10-24 22:27:38 · 161 阅读 · 0 评论 -
波动序列 dp
P2467 [SDOI2010]地精部落题目描述传说很久以前,大地上居住着一种神秘的生物:地精。地精喜欢住在连绵不绝的山脉中。具体地说,一座长度为N的山脉H可分为从左到右的N段,每段有一个独一无二的高度Hi,其中Hi是1到N之间的正整数。如果一段山脉比所有与它相邻的山脉都高,则这段山脉是一个山峰。位于边缘的山脉只有一段相邻的山脉,其他都有两段(即左边和右边)。类似地,如果一段山脉比所有它...原创 2019-10-24 14:35:59 · 165 阅读 · 0 评论 -
概率dp Lights inside 3D Grid
Lights inside 3D Grid You are given a 3D grid, which has dimensions X, Y and Z. Each of the X x Y x Z cells contains a light. Initially all lights are off. You will have K turns. In each of the K tur...原创 2019-10-22 18:48:28 · 116 阅读 · 0 评论 -
概率dp Discovering Gold
Discovering GoldYou are in a cave, a long cave! The cave can be represented by a 1 x N grid. Each cell of the cave can contain any amount of gold.Initially you are in position 1. Now each turn you t...原创 2019-10-22 15:33:26 · 74 阅读 · 0 评论 -
期望dp A Dangerous Maze
A Dangerous MazeYou are in a maze; seeing n doors in front of you in beginning. You can choose any door you like. The probability for choosing a door is equal for all doors.If you choose the ith doo...原创 2019-10-22 14:21:43 · 72 阅读 · 0 评论 -
区间dp String painter
String painterProblem DescriptionThere are two strings A and B with equal length. Both strings are made up of lower case letters. Now you have a powerful string painter. With the help of the painter...原创 2019-10-22 12:52:15 · 104 阅读 · 0 评论 -
多重背包的二进制优化
P4544 [USACO10NOV]购买饲料Buying Feed约翰开车来到镇上,他要带KK吨饲料回家。运送饲料是需要花钱的,如果他的车上有XX吨饲料,每公里就要花费X2X^2X2 元,开车D公里就需要D×X2D\times X^2D×X2 元。约翰可以从N家商店购买饲料,所有商店都在一个坐标轴上,第ii家店的位置是XiX_iXi ,饲料的售价为每吨CiC_iCi 元,库存为FiF_...原创 2019-10-19 23:43:43 · 146 阅读 · 0 评论 -
Football概率dp
POJ3071DescriptionConsider a single-elimination football tournament involving 2n2^n2n teams, denoted 1,2,…,2n1, 2, …, 2^n1,2,…,2n. In each round of the tournament, all teams still in the tournament ...原创 2019-10-02 23:48:46 · 108 阅读 · 0 评论 -
区间dp
You Are the One The TV shows such as You Are the One has been very popular. In order to meet the need of boys who are still single, TJUT hold the show itself. The show is hold in the Small hall, so i...原创 2019-09-27 13:19:13 · 83 阅读 · 0 评论 -
区间dp+判断凸包
CakeYou want to hold a party. Here’s a polygon-shaped cake on the table. You’d like to cut the cake into several triangle-shaped parts for the invited comers. You have a knife to cut. The trace of ea...原创 2019-09-27 11:03:17 · 150 阅读 · 0 评论 -
dp上升子序列方案数
P3970 [TJOI2014]上升子序列题目描述给定一个只包含整数的序列(序列元素的绝对值大小不超过10^9),你需要计算上升子序列的个数,满足如下条件的称之为一个上升子序列:是原序列的一个子序列长度至少为2所有元素都严格递增如果两个上升子序列相同,那么只需要计算一次。例如:序列{1,2,3,3}有4个上升子序列,分别为{1,2}{1,3},{1,2,3},{2,3}...原创 2019-08-04 19:45:59 · 686 阅读 · 0 评论 -
P2822 组合数问题
小葱想知道如果给定 n,m 和 k,对于所有的 0≤i≤n,0≤j≤min(i,m) 有多少对 (i,j)(i,j) 满足 Ci取j 是 k 的倍数。输入格式:第一行有两个整数 t,kt,k,其中 tt 代表该测试点总共有多少组测试数据,k 的意义见问题描述。接下来 tt 行每行两个整数 n,m,其中 n,m 的意义见问题描述。输出格式:共 t行,每行一个整数代表所有的0≤i≤n,0≤j...原创 2019-07-17 19:51:44 · 247 阅读 · 0 评论 -
01背包+路径记录
L3-001 凑零钱 (30 分)韩梅梅喜欢满宇宙到处逛街。现在她逛到了一家火星店里,发现这家店有个特别的规矩:你可以用任何星球的硬币付钱,但是绝不找零,当然也不能欠债。韩梅梅手边有 10^4 枚来自各个星球的硬币,需要请你帮她盘算一下,是否可能精确凑出要付的款额。输入格式:输入第一行给出两个正整数:N(≤10^4 )是硬币的总个数,M(≤10 ^2 )是韩梅梅要付的款额...原创 2019-07-20 12:13:29 · 884 阅读 · 2 评论 -
P1880 [NOI1995]石子合并
题目描述在一个圆形操场的四周摆放N堆石子,现要将石子有次序地合并成一堆.规定每次只能选相邻的2堆合并成新的一堆,并将新的一堆的石子数,记为该次合并的得分。试设计出1个算法,计算出将N堆石子合并成1堆的最小得分和最大得分.输入格式:数据的第1行试正整数N,1≤N≤100,表示有N堆石子.第2行有N个数,分别表示每堆石子的个数.输出格式:输出共2行,第1行为最小得分,第2行为最大得分.输...原创 2019-07-11 21:56:03 · 131 阅读 · 0 评论