layout: post title: 「kuangbin带你飞」专题二十二 区间DP author: "luowentaoaa" catalog: true tags: - kuangbin - 区间DP - 动态规划 传送门 B.LightOJ - 1422 Halloween Costumes 题意 按顺序参加舞会,参加一个舞会要穿一种衣服,可以在参加完一个舞会后套上另一个衣服再去参加舞会,也可以在参加一个舞会的时候把外面的衣服脱了,脱到合适的衣服,但是脱掉的衣服不能再穿,参加完…
「bzoj1003」「ZJOI2006」物流运输-----------------------------------------------------------------------------------------------------------------------------------------Description 物流公司要把一批货物从码头A运到码头B.由于货物量比较大,需要n天才能运完.货物运输过程中一般要转停好几个码头.物流公司通常会设计一条固定的运输路线,以便…
1260: [CQOI2007]涂色paint Time Limit: 30 Sec  Memory Limit: 64 MBSubmit: 2057  Solved: 1267[Submit][Status][Discuss] Description 假设你有一条长度为5的木版,初始时没有涂过任何颜色.你希望把它的5个单位长度分别涂上红.绿.蓝.绿.红色,用一个长度为5的字符串表示这个目标:RGBGR. 每次你可以把一段连续的木版涂成一个给定的颜色,后涂的颜色覆盖先涂的颜色.例如第一次把木版涂…
题目描述 Bessie likes downloading games to play on her cell phone, even though she does find the small touch  screen rather cumbersome to use with her large hooves.She is particularly intrigued by the current g ame she is playing. The game starts with a…
题目描述 给定一个长为n的整数序列(n<=1000),由A和B轮流取数(A先取).每个人可从序列的左端或右端取若干个数(至少一个),但不能两端都取.所有数都被取走后,两人分别统计所取数的和作为各自的得分.假设A和B都足够聪明,都使自己得分尽量高,求A的最终得分. 输入输出格式 输入格式: 第一行,一个正整数T,表示有T组数据.(T<=100) 接着T行,每行第一个数为n,接着n个整数表示给定的序列. 输出格式: 输出T行,每行一个整数,表示A的得分 输入输出样例 输入样例#1: 复制 2 1…
成绩单 $f[l][r][mi][mx]$表示从l到r发到还没发的部分的最小值为mi最大值为mx时的最小代价. $f[l][r][0][0]$表示从l到r全部发完的代价. 自己写的无脑dp,枚举中转点k,分成(i,k) (k+1,j)两个区间,分别用mi,mx都在左区间,都在右区间,一个左一个右来转移,这样会发现可以转移过来的都是某个一维或者二维前缀和的形式,于是我开了四个二维数组,暴力维护了6个前缀和更新答案... 然后代码就比较鬼畜 //Achen #include<algorithm>…
题目描述  给定一个1*n的地图,在里面玩2048,每次可以合并相邻两个(数值范围1-40),问最大能合出多少.注意合并后的数值并非加倍而是+1,例如2与2合并后的数值为3. 这道题的思路: 状态: f[i][j] 代表当前 i -> j的最大值 . 初始的f[i][i] = a[i]. 然后枚举点 1 -> n-1 到 n 的区间. 然后中间再枚举断点 k. 方程就是 f[i][j] = max(f[k+1][j]+1,f[i][j]); 约束条件: 当且仅当两个区间所得到的最大值相同的时候…
4580: [Usaco2016 Open]248 Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 255  Solved: 204[Submit][Status][Discuss] Description Bessie likes downloading games to play on her cell phone, even though she does find the small touch  screen rather cumbers…
题目描述 Bessie likes downloading games to play on her cell phone, even though she doesfind the small touch screen rather cumbersome to use with her large hooves. She is particularly intrigued by the current game she is playing.The game starts with a seq…
[USACO16OPEN]248 G 题目: 题目描述 Bessie likes downloading games to play on her cell phone, even though she doesfind the small touch screen rather cumbersome to use with her large hooves. She is particularly intrigued by the current game she is playing.The…