![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
动态规划
dp
sigh_
这个作者很懒,什么都没留下…
展开
-
CodeForces_1437E Make It Increasing(动态规划)
Make It Increasingtime limit per test:2 secondsmemory limit per test:256 megabytesProblem DescriptionYou are given an array of n integers a1,a2,...,ana_1, a_2, ..., a_na1,a2,...,an, and aaa set bbb of kkk distinct integers from 111 to nnn.In one op原创 2020-10-28 13:34:33 · 488 阅读 · 0 评论 -
洛谷_2470 [SCOI2007]压缩
[SCOI2007]压缩题目链接:https://www.luogu.com.cn/problem/P2470题解:区间DP。设dp[i][j]dp[i][j]dp[i][j]代表字母iii前面有字母‘M’,字符串[i,j][i,j][i,j]子段压缩后的最短长度。递推式:dp[i][j]=min(dp[i][j],dp[i][k]+j−k)(i≤k<j)dp[i][j] = min(dp[i][j], dp[i][k]+j-k)(i\le k<j)dp[i][j]=min(dp[i]原创 2020-08-16 16:02:54 · 92 阅读 · 0 评论 -
CodeForces_1139D Steps to One(数论)
Steps to Onetime limit per test:2 secondsmemory limit per test:256 megabytesProblem DescriptionVivek initially has an empty array a and some integer constant m.He performs the following algorithm:Select a random integer x uniformly in range from 1 t原创 2020-08-04 20:40:09 · 232 阅读 · 0 评论 -
ZOJ_1918 Ferry Loading II(动态规划)
Ferry Loading IITime Limit: 2000 msMemory Limit: 65536 KBProblem DescriptionBefore bridges were common, ferries were used to transport cars across rivers. River ferries, unlike their larger cousins, run on a guide line and are powered by the river’s cu原创 2020-07-31 23:41:12 · 186 阅读 · 0 评论 -
CodeForces_1381B Unmerge(动态规划)
Unmergetime limit per test:1 secondsmemory limit per test:256 megabytesProblem DescriptionLet aaa and bbb be two arrays of lengths nnn and mmm, respectively, with no elements in common. We can define a new array merge(a,b)(a,b)(a,b) of length n+mn+mn+m原创 2020-07-24 15:14:50 · 225 阅读 · 0 评论 -
洛谷_1642 规划(分数规划+动态规划)
规划题目链接:https://www.luogu.com.cn/problem/P1642题解:分数规划,设d[i]=a[i]−mid∗b[i]d[i] = a[i]-mid*b[i]d[i]=a[i]−mid∗b[i].check:动态规划,求是否存在m个点连通块d[i]d[i]d[i]。dp[u][i]dp[u][i]dp[u][i]代表以uuu为根节点的子树,选iii个节点能得到的最大的d[i]d[i]d[i]和。递推方程dp[u][j+k]=max(dp[u][j+k],dp[u][j]+原创 2020-06-21 09:32:16 · 232 阅读 · 0 评论 -
CodeForces_1354E Graph Coloring(DFS+动态规划)
Graph Coloringtime limit per test:2 secondsmemory limit per test:256 megabytesProblem DescriptionYou are given an undirected graph without self-loops or multiple edges which consists of n vertices and m edges. Also you are given three integers n1n_1n1原创 2020-05-18 11:08:22 · 358 阅读 · 0 评论 -
CodeForces_1353F Decreasing Heights(动态规划)
Decreasing Heightstime limit per test:2.5 secondsmemory limit per test:256 megabytesProblem DescriptionYou are playing one famous sandbox game with the three-dimensional world. The map of the world can be represented as a matrix of size n×m, where the原创 2020-05-15 18:01:39 · 380 阅读 · 0 评论 -
CodeForces_1348E Phoenix and Berries(动态规划)
Phoenix and Berriestime limit per test:2 secondsmemory limit per test:256 megabytesProblem DescriptionPhoenix is picking berries in his backyard. There are n shrubs, and each shrub has ai red berr...原创 2020-05-02 14:49:08 · 1080 阅读 · 0 评论 -
CodeForces_1340B Nastya and Scoreboard(动态规划)
Nastya and Scoreboardtime limit per test:1 secondsmemory limit per test:256 megabytesProblem DescriptionDenis, who managed to buy flowers and sweets (you will learn about this story in the next ta...原创 2020-04-24 17:44:05 · 226 阅读 · 0 评论 -
ZOJ_2283 Challenge of Wisdom(动态规划)
Challenge of WisdomTime Limit: 2000 msMemory Limit: 32768 KBProblem Description“I have a great deal of lands. They’re divided into N*M grids (N, M <= 1,000,000,000). When you are in (x, y), you...原创 2020-04-23 12:27:55 · 201 阅读 · 0 评论 -
洛谷_2495 [SDOI2011]消耗战(虚树)
消耗战题目链接:https://www.luogu.com.cn/problem/P2495题解:对于单样例,可以考虑树形DP。但此题是多实例,所以需要对树进行处理,每次询问有k+1(加上一号点)个关键点。对每个询问构造出虚树。边权:虚树的边上的权值,为原树中两点路径上的边权最小值,可以利用倍增的思想求权值。DP:对于虚树,设dpidp_idpi为以iii为根的子树都与i号节点断开连...原创 2020-04-21 17:49:13 · 148 阅读 · 0 评论 -
51nod_2361 XYK的音游(动态规划)
XYK的音游Problem Descriptionxyk最近入坑了一个新音游。游戏界面上有 nnn 个并排的按键,当前这首歌有 mmm 个鼓点。游戏的玩法是在鼓点的时刻移动鼠标到对应的按键上并点击来获取分数。对于第 i 个鼓点,我们用tit_iti,wiw_iwi,xix_ixi 来描述,表示在tit_iti 时刻点击第 xix_ixi 个按键会获得 wiw_iwi 的分数。...原创 2020-04-16 21:07:01 · 236 阅读 · 0 评论 -
ZOJ_3777 Problem Arrangement(动态规划)
Problem Arrangement Time Limit: 2000 msMemory Limit: 65536 KBProblem DescriptionThe 11th Zhejiang Provincial Collegiate Programming Contest is coming! As a problem setter, Edward is going to arran...原创 2020-04-12 20:34:22 · 111 阅读 · 0 评论 -
51nod_2369 奈芙莲的序列(动态规划)
奈芙莲的序列Problem Description有一天可爱的Nephren得到了一个序列,一开始,她取出序列的第一个数,形成一个新的序列B,然后取出序列A的第二个数,放在序列B的最左边或最右边,序列B此时有两个数,下一步,再取出序列A的第三个数放在序列B的最左边或最右边,……现在的问题是,通过上面的步骤,可以得到B的最长上升子序列的长度是多少Input第一行,一个整数N.第二行,N个...原创 2020-04-09 09:29:43 · 166 阅读 · 0 评论 -
hdu_4216 Computational Geometry?(动态规划)
Computational Geometry?Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Problem DescriptionComputational geometry is a branch of computer science devoted to the...原创 2020-02-17 17:55:02 · 197 阅读 · 0 评论