HDU 6199 DP】的更多相关文章

强行卡内存 这题在CF上好像有道极相似的题 可以想到状态设计为dp[f][i][k]表示f在取完i-1时,此时可以取k个或k+1个的状态下的最大值.之前以为n是1e5,自己想不到怎么设计状态真的辣鸡,把题目扔给队友写,实际上n是1e4,k就算不断递增最大也只有200左右,实际上是开的下的. 由于最终局面下的最优决策是固定的,所以从后往前转移. 但是人家说本来题目就too simple了,觉得你这样申请空间还是太naive,会给你MLE. 可以注意到状态i只由i+k+1或i+k转移,k范围是200…
gems gems gems Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1778    Accepted Submission(s): 424 Problem Description Now there are n gems, each of which has its own value. Alice and Bob play a…
Man Down Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2030    Accepted Submission(s): 743 Problem Description The Game “Man Down 100 floors” is an famous and interesting game.You can enjoy t…
给出点集,和不大于L长的绳子,问能包裹住的最多点数. 考虑每个点都作为左下角的起点跑一遍极角序求凸包,求的过程中用DP记录当前以j为当前末端为结束的的最小长度,其中一维作为背包的是凸包内侧点的数量.也就是 dp[j][k]代表当前链末端为j,其内部点包括边界数量为k的最小长度.这样最后得到的一定是最优的凸包. 然后就是要注意要dp[j][k]的值不能超过L,每跑一次凸包,求个最大的点数量就好了. 和DP结合的计算几何题,主要考虑DP怎么搞 /** @Date : 2017-09-27 17:27…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6199 题意:n堆石子,Alice和Bob来做游戏,一个人选择取K堆那么另外一个人就必须取k堆或者k+1堆,两个人都想使用最优策略使得取出的石子的和的差值最大. 解法:http://blog.csdn.net/DorMOUSENone/article/details/77929439 膜大牛 用动态规划的思路来思考,每个人都想最大化自己和另外一个人的差值,其实这个题,完全可以省掉判断是谁的这一维,使得…
题目链接 Problem Description Now there are n gems, each of which has its own value. Alice and Bob play a game with these n gems.They place the gems in a row and decide to take turns to take gems from left to right. Alice goes first and takes 1 or 2 gems…
gems gems gems Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem Description Now there are n gems, each of which has its own value. Alice and Bob play a game with these n gems.They place the gems in a row and…
有n(2e4)个宝石两个人轮流从左侧取宝石,Alice先手,首轮取1个或2个宝石,如果上一轮取了k个宝石,则这一轮只能取k或k+1个宝石.一旦不能再取宝石就结束.双方都希望自己拿到的宝石数比对方尽可能多.问你,先手比后手多拿的最大宝石数. dp[s][k] 表示从已经拿了s个,这一次可以拿k个,也可以拿k+1个. 那么dp[s][k] 表示 已经拿了s个,这一次可以拿k个或k+1个的最大差值. #include <cstdio> #include <cstdlib> #includ…
B - Monkey and Banana Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1069 Appoint description: Description A group of researchers are designing an experiment to test the IQ of a monkey. They wi…
G - FatMouse's Speed Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1160 Appoint description: Description FatMouse believes that the fatter a mouse is, the faster it runs. To disprove this, you…