
动态规划-线性DP
文章平均质量分 79
snowy_smile
终于在ICPC World Final里拿到了气球!
再努力一点吧,坚持下去吧,梦想是会实现的! 人生会有低谷,但我更相信,未来也会有更多梦想能够实现~
展开
-
【UKIEPC2015 G】【DP】Drink Responsibly 买酒喝 双关键字DP恰好都用完 注意精度
#include #include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;void fre(){freopen("c://test//input.in","r",stdin);freopen("原创 2015-11-03 17:42:04 · 1385 阅读 · 0 评论 -
【Manthan, Codefest 16E】【DP 从右向左线性扫描不用ST-RMQ】Startup Funding 最大的min(取min,取max) + n值选k最小做权的期望
E. Startup Fundingtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn e-commerce startup pitches to the investors to原创 2016-02-28 17:08:04 · 787 阅读 · 1 评论 -
【CROC 2016 - Elimination RoundE】【DP】Intellectual Inquiry 长度为m字符串后添加n位最大本质不同子串个数
Intellectual Inquirytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAfter getting kicked out of her report原创 2016-03-19 12:35:03 · 987 阅读 · 0 评论 -
【2015-2016 XVI Open CupJ】【DP bitset记录方案】Judgement n人投票前后权威值改变是否有实际区别
J. Judgementtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe jury of Berland regional olympiad in infor原创 2016-03-08 18:54:07 · 947 阅读 · 0 评论 -
【ZOJ3929 The 16th Zhejiang University Programming ContestC】【DP】Deque and Balls n个数放入双端队列2^n种方案有多少个位置
Deque and BallsTime Limit: 2 Seconds Memory Limit: 65536 KBThere are n balls, where the i-th ball is labeled as pi. You are going to put n balls into a deque. In the i-th turn, you ne原创 2016-04-12 13:07:18 · 783 阅读 · 0 评论 -
【ZOJ3931 The 16th Zhejiang University Programming ContestE】【小根堆 哈夫曼树 DP】Exact Compression 建立哈弗曼树并编码0
#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;void fre() { freopen("c://test//input.in", "r", stdin原创 2016-04-12 13:09:16 · 1207 阅读 · 0 评论 -
【HDU5653 BestCoder Round 77 (div1) C】【DP 复杂度计算】Bomber Man wants to bomb an Array n炸弹设置爆炸左右界 最大爆炸力的乘积
Bomber Man wants to bomb an Array. Accepts: 56 Submissions: 225 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)问题描述给一个长度为 NN 的一维格子和一些炸弹的位置原创 2016-03-27 11:15:39 · 480 阅读 · 0 评论 -
【hihocoder1290 微软2016校园招聘4月在线笔试C】【二维DP】 Demo Day 机器人遇到障碍向右走向下走 最少调整数使得左上角走到右下角
Demo Day时间限制:10000ms单点时限:1000ms内存限制:256MB描述You work as an intern at a robotics startup. Today is your company's demo day. During the demo your company's robot will be put原创 2016-04-10 12:15:08 · 904 阅读 · 0 评论 -
【HDU5748 BestCoder Round 84B】【LIS模板 最长单调上升子序列】Bellovin 以尾端点最长LIS压缩数组
BellovinAccepts: 428Submissions: 1685Time Limit: 6000/3000 MS (Java/Others)Memory Limit: 131072/131072 K (Java/Others)问题描述Peter有一个序列a1,a2,...,ana_1,a_2,...,a_na1,a2,...,an原创 2016-07-25 09:31:44 · 650 阅读 · 0 评论 -
【Codeforces Round 363 (Div 2) C】【简单DP】Vacations 一天运动 一天学习最少休息日数
C. Vacationstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya has n days of vacations! So he decided to原创 2016-07-26 09:07:52 · 799 阅读 · 0 评论 -
【Codeforces Round 367 (Div 2) C】【简单DP】Hard problem
C. Hard problemtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasiliy is fond of solving different tasks.原创 2016-08-12 10:21:50 · 521 阅读 · 0 评论 -
【HDU5896 2016 ACM ICPC Asia Regional Shenyang Online E】【DP 排列组合 分治ntt】Running King n个点构成含环无向图的方案数.cp
Running KingTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 201 Accepted Submission(s): 71Problem DescriptionIn People's Republic原创 2016-09-22 10:15:03 · 1579 阅读 · 0 评论 -
【Codeforces Round 374 (Div 2)C】【DAG上的DP】Journey 有向无环图从1到n时刻T内的最多经过点数
C. Journeytime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputRecently Irina arrived to one of the most famous原创 2016-10-01 12:09:33 · 1132 阅读 · 0 评论 -
【HDU5928 2016CCPC东北地区大学生程序设计竞赛 - 重现赛 G】【计算几何 凸包思想 枚举底点做DP】Birthday Gift 给定绳长最多围住多少个点
Birthday GiftTime Limit: 9000/4500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 118 Accepted Submission(s): 24Problem DescriptionBoth Mr. Frog and W原创 2016-10-08 16:41:40 · 1661 阅读 · 0 评论 -
【hihocoder [Offer收割]编程练习赛9 C】【简单DP】三等分
题目3 : 三等分时间限制:10000ms单点时限:1000ms内存限制:256MB描述小Hi最近参加了一场比赛,这场比赛中小Hi被要求将一棵树拆成3份,使得每一份中所有节点的权值和相等。比赛结束后,小Hi发现虽然大家得到的树几乎一模一样,但是每个人的方法都有所不同。于是小Hi希望知道,对于一棵给定的有根树,在选取其中2个非根节点并将原创 2017-03-12 17:35:17 · 616 阅读 · 0 评论 -
【Hihocoder [Offer收割]编程练习赛10 B】【简单DP】出勤记录II
题目2 : 出勤记录II时间限制:10000ms单点时限:1000ms内存限制:256MB描述小Hi的算法课老师每次上课都会统计小Hi的出勤记录。迟到会被记录一个L,缺席会被记录一个A,按时上课会被记录一个O。一学期结束,小Hi的出勤记录可以看成是一个只包含LAO的字符串,例如"OOOOLOOOLALLO……"。如果小Hi整学期缺原创 2017-03-23 18:47:05 · 734 阅读 · 0 评论 -
【“盛大游戏杯”第15届上海大学程序设计联赛 F】【LIS模板题】A序列
A序列发布时间: 2017年7月9日 18:17 最后更新: 2017年7月9日 21:05 时间限制: 1000ms 内存限制: 128M描述如果一个序列有奇数个正整数组成,不妨令此序列为a1,a2,a3,...,a2∗k+1(0=k),并且a1,a2...ak+1是一个严格递增的序列,ak+1,ak+2,...,a2∗k+1,是一个严格递减的序列,则称此原创 2017-07-10 22:02:06 · 767 阅读 · 0 评论 -
【ZOJ3956 The 17th Zhejiang University Programming Contest I】【01背包】Course Selection System 公式最大化
Course Selection SystemTime Limit: 1 Second Memory Limit: 65536 KBThere are n courses in the course selection system of Marjar University. The i-th course is described by two values: happ原创 2017-04-13 10:30:14 · 912 阅读 · 2 评论 -
【Educational Codeforces Round 6C】【DP or 贪心】Pearls in a Row n个数分最多区间使得每个区间都有重复数
C. Pearls in a Rowtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n pearls in a row. Let's enume原创 2016-03-01 18:19:47 · 472 阅读 · 0 评论 -
【Codeforces Round 274 (Div 2)E】【DP 成段更新 打标记法 滚动数组】Riding in a Lift 乘坐k次电梯避免到达b层的方案数
Riding in a Lifttime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputImagine that you are in a building that has原创 2015-12-08 16:00:03 · 717 阅读 · 0 评论 -
【2015广东工业大学新生赛F】【脑洞 DP打表找规律】有钱的wingkou 取走2个放回1个问最后剩下为0的概率
#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;void fre(){freopen("c://test//input.in","r",stdin);freopen("c:原创 2015-12-07 18:37:46 · 1524 阅读 · 2 评论 -
【HDU5550 2015 CCPC 南阳国赛K】【DP 脑洞 好题】 Game Rooms 每层楼一属性,所有人各得其所 数轴映射+同属性区间段整体更新
#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;void fre(){freopen("c://test//input.in","r",stdin);freopen("c:原创 2015-11-03 16:36:01 · 1700 阅读 · 3 评论 -
【Codeforces Round 326 (Div 2)D】【DP】Duff in Beach 数列重复取数最多k次使得单调不下降
D. Duff in Beachtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWhile Duff was resting in the beach, she acc原创 2015-11-10 11:30:41 · 790 阅读 · 0 评论 -
【ASC44B】【DP】Braess's Paradox 分阶段思想
#include#include#include#include#include#include#include#include#include#include#include#include#include#include#define MS(x,y) memset(x,y,sizeof(x))#define MC(x,y) memcpy(x,y,sizeof(x)原创 2015-10-29 13:11:46 · 632 阅读 · 0 评论 -
【HDU5542 2015 CCPC 南阳国赛C】【DP】The Battle of Chibi n个数中恰好长度为m的单升子序列数
#include#include#includeusing namespace std;const int Z=1e9+7;const int N=1005;int casenum,casei;int n,m;int a[N];int f[N][N];int d[N][N];int top;#includemapmop;map::iterator it;inline v原创 2015-11-02 00:28:58 · 1784 阅读 · 0 评论 -
【HDU5543 2015 CCPC 南阳国赛D】【贪心+DP】Pick The Sticks 木棍重心放在容器内 贪心法+三维状态直接法
这题我采取了两种做法。下面提供两份代码。前者较为麻烦,但是基于一定的贪心原则, 状态少,效率高。后者写起来方便,速度稍慢。#include #include#includeusing namespace std;#define MS(x,y) memset(x,y,sizeof(x))#define MC(x,y) memcpy(x,y,sizeof(x))typedef原创 2015-11-02 13:37:03 · 1993 阅读 · 2 评论 -
【Codeforces Round 273 (Div 2)D】【DP 滚动数组】 Red-Green Towers 两种颜色积木拼搭最高锯齿楼每层颜色相同的总方案数
D. Red-Green Towerstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are r red and g green blocks for原创 2015-12-11 17:22:01 · 2093 阅读 · 0 评论 -
【HDU5569 BestCoder Round 63 (div1)B】【DP】matrix 向右走向下走最大乘积和
matrixTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 408 Accepted Submission(s): 243Problem DescriptionGiven a matrix with n row原创 2015-11-25 09:32:41 · 598 阅读 · 0 评论 -
【HDU5568 BestCoder Round 63 (div1)A】【DP java高精度】sequence2 长度恰好为m的LIS数
sequence2Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 493 Accepted Submission(s): 183Problem DescriptionGiven an integer array原创 2015-11-25 09:34:11 · 617 阅读 · 0 评论 -
【HDU5188 BestCoder Round 33C】【贪心排序+DP】zhx and contest 考试不被怀疑作弊条件下达到至少m分的最少时间
#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;void fre(){freopen("c://test//input.in","r",stdin);freopen("c:原创 2015-11-19 20:52:15 · 748 阅读 · 0 评论 -
【HDU5534 2015长春赛区H】【树上DP转完全背包】Partial Tree 不同度不同权对应最大树权
#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;void fre(){freopen("c://test//input.in","r",stdin);freopen("c:原创 2015-11-02 21:38:45 · 1742 阅读 · 0 评论 -
【HDU5532 2015长春赛区F】【LIS+剪枝】Almost Sorted Array 最多移除一元素后单调 O(n)
#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;void fre(){freopen("c://test//input.in","r",stdin);freopen("c:原创 2015-11-03 13:57:35 · 897 阅读 · 0 评论 -
【Codeforces Testing Round 12C】【DP 树状数组优化】Subsequences n个不同数,长度为m的LIS数
C. Subsequencestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputFor the given sequence with n different elem原创 2015-11-27 10:43:58 · 600 阅读 · 0 评论 -
【Codeforces Beta Round 2B】【贪心 DP】The least round way 从(1,1)走到(n,n)乘积尾数0尽可能少
B. The least round waytime limit per test5 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputThere is a square matrix n × n, consi原创 2015-12-01 14:31:57 · 963 阅读 · 0 评论 -
【2015ZUFE新生赛网络同步赛H】【水题 DP】会长晨刷记 步长1~4 不踩水坑从1到m
#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;void fre(){freopen("c://test//input.in","r",stdin);freopen("c:原创 2015-12-07 12:18:23 · 815 阅读 · 0 评论 -
【2015ZUFE新生赛网络同步赛M】【DP 打表 二分】GW I (3) 暴力预处理+分类打表二分查找
#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;void fre(){freopen("c://test//input.in","r",stdin);freopen("c:原创 2015-12-07 12:21:25 · 641 阅读 · 1 评论 -
【Codeforces Round 336 (Div 2) C】【贪心 DP思维】Chain Reaction 每个灯塔位置为a[]破坏b[]范围所有灯塔 设置一个灯塔使得最多灯塔被保留
C. Chain Reactiontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n beacons located at distinct p原创 2015-12-25 11:47:38 · 1338 阅读 · 1 评论 -
【Codeforces Round 271 (Div 2)D】【DP】Flowers 黑色必须连续摆放k,长度为n的摆放方案数
D. Flowerstime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWe saw the little game Marmot made for Mole's lu原创 2015-12-08 11:08:56 · 629 阅读 · 0 评论 -
【HDU6197 2017 ACM ICPC Asia Regional Shenyang Online D】【LIS 最长不下降序列】array array array 数列删除恰好K个数,使得恰好
array array arrayTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 233 Accepted Submission(s): 141Problem DescriptionOne day, K原创 2017-09-11 09:54:45 · 641 阅读 · 0 评论