
dp
qq_2456160268
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
棋盘游戏 51Nod - 1327
题解:在放置棋子时仅仅要求左右满足条件与n的顺序无关,考虑一个二维dp数组,dp[i][j]代表放到了第i列还有j列没有放棋子,但是这个二维dp没有维护右限的信息,所以考虑增加一维代表有多少行到达了右限但没有棋子,将l和r区间的限制统计,可以得到dp转移方程:dp[a+1][b+1-l[a+1]][c+r[a+1]]+=dp[a][b][c]*sum[b+1][l[a+1]]%mod;枚举到当第i列,有l[i]行必须要放左区间了,从空的列中选择放入当前列不放入,同时加上到达右限的区间d.原创 2020-07-13 17:42:57 · 290 阅读 · 0 评论 -
Hie with the Pie POJ - 3311
传送门题目:The Pizazz Pizzeria prides itself in delivering pizzas to its customers as fast as possible. Unfortunately, due to cutbacks, they can afford to hire only one driver to do the deliveries. He ...原创 2019-01-25 20:32:44 · 131 阅读 · 0 评论 -
Kefa and Dishes CodeForces - 580D
传送门题目:When Kefa came to the restaurant and sat at a table, the waiter immediately brought him the menu. There were n dishes. Kefa knows that he needs exactly m dishes. But at that, he doesn't want...原创 2019-01-25 20:42:49 · 248 阅读 · 0 评论 -
A and B and Interesting Substrings
传送门题目:A and B are preparing themselves for programming contests.After several years of doing sports programming and solving many problems that require calculating all sorts of abstract objects, ...原创 2019-02-27 13:42:31 · 196 阅读 · 0 评论 -
And Reachability(DP)
传送门Toad Pimple has an array of integersa1,a2,…,ana1,a2,…,an.We say thatyyis reachable fromxxifx<yx<yand there exists an integer arrayppsuch thatx=p1<p2<…<pk=yx=p1<p2<...原创 2019-06-05 20:46:07 · 229 阅读 · 0 评论 -
E. Minimal Segment Cover(dp)
传送门题意:给你n个线段,m次询问,让你输出n条线段中能完全覆盖询问的线段的最小数量题解:乍一看有点像区间覆盖问题,但是它n和m给你的是5e5,很大,所以对于询问应该近可能快速的得出答案,同时对于序列的操作也只能在询问前进行;通过对线段的处理,我们可以得到每个点只用一条线段最远能跳到哪个位置,同理用俩条线段最远能跳到哪也可以求出,然后如果跳x条线段之后就大于了右端点,最小数量就是x,如果有...原创 2019-06-12 21:07:18 · 273 阅读 · 0 评论