
DP
文章平均质量分 82
Pira
追求梦想的人,难免有些不切实际。。。
展开
-
hdu 3377(插头DP一条回路固定端点)
PlanTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 207 Accepted Submission(s): 54Problem DescriptionOne day, Resty comes to an inc原创 2011-06-09 15:24:00 · 1366 阅读 · 4 评论 -
NOI 2005 瑰丽华尔兹(DP+单调队列)
1499: [NOI2005]瑰丽华尔兹Time Limit: 3 Sec Memory Limit: 64 MBSubmit: 490 Solved: 250[Submit][Status][Discuss]Description你跳过华尔兹吗?当音乐响起,当你随着旋律滑动舞步,是不是有一种漫步仙境的惬意? 众所周知,跳华尔兹时,最重要的是有好的音乐。但是很少有几个人原创 2012-08-19 20:54:44 · 3120 阅读 · 1 评论 -
poj 3093 Margaritas on the River Walk(01背包统计)
Margaritas on the River WalkTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2126 Accepted: 792DescriptionOne of the more popular activities in San Ant原创 2012-09-26 16:17:36 · 1500 阅读 · 0 评论 -
usaco 5.4 Character Recognition(统计DP)
Character RecognitionThis problem requires you to write a program that performs character recognition.Each ideal character image has 20 lines of 20 digits. Each digit is a `0' or a `1'. See Figu原创 2012-09-26 22:20:14 · 1591 阅读 · 0 评论 -
芯片制作(插头DP写法)
ZJN是QDEZ有名的帅哥之一,作为学生会的重要干部,经常接到丰富多彩的学生活动的通知,下面就是一项科技实践活动~~~~~计算机的大脑通常被称为CPU。现在国家XX局交给ZJN一个重要任务,要求他制作一种新型的CPU,幸运的是,CPU研究中心已经将好多个CPU内核蚀刻在硅片上了,这种硅片很可爱,它是由3n2个内核拼成的L型。当n=5的时候,硅片的形状如下图所示。ZJN的任务就是把CPU内核原创 2011-05-19 16:53:00 · 1389 阅读 · 0 评论 -
ural 1519(插头DP入门题)
1519. Formula 1Time Limit: 1.0 secondMemory Limit: 16 MBBackgroundRegardless of the fact, that Vologda could not get rights to hold the Winter Olympic games of 20**, it is well-known, that原创 2011-06-08 16:56:00 · 3111 阅读 · 3 评论 -
usaco 5.5 Twofive(统计+DP)
TwofiveIOI 2001In order to teach her young calvess the order of the letters in the alphabet, Bessie has come up with a game to play with them. The calves are given a 5 x 5 grid on which they can p原创 2012-10-04 11:52:24 · 1256 阅读 · 0 评论 -
usaco 6.1 A Rectangular Barn(最大子矩阵)
A Rectangular BarnMircea Pasoi -- 2003Ever the capitalist, Farmer John wants to extend his milking business by purchasing more cows. He needs space to build a new barn for the cows.FJ purchase原创 2012-10-04 15:02:51 · 1029 阅读 · 0 评论 -
usaco 6.1 Postal Vans(插头DP)
Postal VansACM South Pacific Region -- 2003Tiring of their idyllic fields, the cows have moved to a new suburb. The suburb is a rectangular grid of streets with a post office at its Northwest原创 2012-10-04 14:40:02 · 1018 阅读 · 0 评论 -
poj 3245 Sequence Partitioning(dp+二分+单调队列+sbt)
Sequence PartitioningTime Limit: 8000MS Memory Limit: 65536KTotal Submissions: 710 Accepted: 207Case Time Limit: 5000MSDescriptionGiven a sequence of N orde原创 2012-09-15 19:24:31 · 1539 阅读 · 0 评论 -
CF 76F Tourist(最长不递减子序列变形)
F. Touristtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputTourist walks along the X axis. He can choose eit原创 2012-10-04 21:16:52 · 1633 阅读 · 0 评论 -
hdu 3530 Subsequence(DP+单调队列优化)
SubsequenceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2518 Accepted Submission(s): 826Problem DescriptionThere is a sequ原创 2012-08-19 19:02:32 · 1360 阅读 · 0 评论 -
hdu 3401 Trade(DP+单调队列优化)
TradeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2118 Accepted Submission(s): 665Problem DescriptionRecently, lxhgww is a原创 2012-08-18 16:42:46 · 1435 阅读 · 0 评论 -
poj 1739(男人八题之插头DP)
Tony's TourTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 1680 Accepted: 751DescriptionA square township has been divided up into n*m(n rows and m column原创 2011-06-08 19:51:00 · 1875 阅读 · 0 评论 -
zoj 3466(插头DP 多条回路 六边形)
The Hive IITime Limit: 5 Seconds Memory Limit: 65536 KBThere is a hive in the village. Like this. There are 8 columns(from A to H) in this hive. Different colums have the same number of g原创 2011-06-06 13:13:00 · 1657 阅读 · 0 评论 -
hdu 4331 Image Recognition(DP+线段树)2012 Multi-University Training Contest 4
Image RecognitionTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 377 Accepted Submission(s): 137Problem DescriptionNow there原创 2012-08-04 11:38:03 · 996 阅读 · 0 评论 -
hdu 4340 Capturing a country(树形DP) 2012 Multi-University Training Contest 5
Capturing a countryTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 21 Accepted Submission(s): 6Problem DescriptionAnt and Bob原创 2012-08-07 19:13:16 · 1074 阅读 · 0 评论 -
usaco 4.3 Buy Low, Buy Lower(DP+大数)
Buy Low, Buy LowerThe advice to "buy low" is half the formula to success in the stock market. But to be considered a great investor you must also follow this problems' advice:"Buy low, buy low原创 2012-07-26 11:48:02 · 728 阅读 · 0 评论 -
hdu 4317 Unfair Nim(状态压缩DP)——2012 Multi-University Training Contest 2
Unfair NimTime Limit: 20000/10000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 225 Accepted Submission(s): 83Problem DescriptionAlice and Bob ar原创 2012-07-27 19:56:26 · 1402 阅读 · 4 评论 -
hdu 4328 Cut the cake(最大子矩阵)2012 Multi-University Training Contest 3
Cut the cakeTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 68 Accepted Submission(s): 26Problem DescriptionMark bought a hug原创 2012-07-31 19:22:49 · 1610 阅读 · 0 评论 -
poj 2823 Sliding Window(简单单调队列)
Sliding WindowTime Limit: 12000MS Memory Limit: 65536KTotal Submissions: 26585 Accepted: 7898Case Time Limit: 5000MSDescriptionAn array of size n ≤ 106 is g原创 2012-08-17 20:37:02 · 957 阅读 · 0 评论 -
FZU 1894 志愿者选拔(简单单调队列)
Problem 1894 志愿者选拔Accept: 772 Submit: 2529Time Limit: 1500 mSec Memory Limit : 32768 KB Problem Description世博会马上就要开幕了,福州大学组织了一次志愿者选拔活动。参加志愿者选拔的同学们排队接受面试官们的面试。参加面试的同学们按照先来先面试并原创 2012-08-17 19:23:16 · 1448 阅读 · 0 评论 -
hdu 3415 Max Sum of Max-K-sub-sequence(单调队列)
Max Sum of Max-K-sub-sequenceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3728 Accepted Submission(s): 1317Problem Description原创 2012-08-18 13:37:53 · 1724 阅读 · 0 评论 -
Lightoj 1422 Halloween Costumes(区间DP)
1422 - Halloween CostumesPDF (English)StatisticsForumTime Limit: 2 second(s)Memory Limit: 32 MBGappu has a very busy weekend ahead of him. Because, next原创 2012-10-05 21:14:10 · 1916 阅读 · 0 评论 -
poj 3017 Cut the Sequence(DP+单调队列+set)
Cut the SequenceTime Limit: 2000MS Memory Limit: 131072KTotal Submissions: 7210 Accepted: 2025DescriptionGiven an integer sequence { an } of length N, you are to原创 2012-09-14 21:19:54 · 1521 阅读 · 0 评论 -
usaco 5.4 Canada Tour(双线程DP)
Canada TourYou have won a contest sponsored by an airline. The prize is a ticket to travel around Canada, beginning in the most western point served by this airline, then traveling only from west原创 2012-09-25 18:58:24 · 1026 阅读 · 0 评论 -
CF 141 Div2 C Fractal Detector(状态压缩DP)
C. Fractal Detectortime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLittle Vasya likes painting fractals ve原创 2012-10-23 19:16:18 · 1179 阅读 · 0 评论 -
srm 556 div1 500 LeftRightDigitsGame2(DP)
Problem Statement You are playing a solitaire game called Left-Right Digits Game. This game uses a deck of N cards. Each card has a single digit written on it. These digits are given as char原创 2012-10-25 10:43:33 · 993 阅读 · 0 评论 -
poj 3624 Charm Bracelet(01背包入门题)
Charm BraceletTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 10399 Accepted: 4667DescriptionBessie has gone to the mall's jewelry store and spies a原创 2011-09-29 10:21:47 · 2099 阅读 · 2 评论 -
ZOJ 2900 Icecream(线段树)
题意:给你一个长度为n的串,从中选出字串,使得长度至少为k,且相邻的数值差的绝对值小于等于p,求这样的字串的个数mod m的值地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2900分析:我们可以马上想到,以前i个数,长度为j的字串个数为f[ i ][ j ],那么有f[ [i ][ j ]=sum{ f[ i原创 2013-03-18 17:51:41 · 1329 阅读 · 0 评论 -
vijos 1069 新年趣事之红包(区间DP)
题目:https://vijos.org/p/1069题意:给你一个凸包,问遍历所有点一遍的最短路径分析:由于图形是一个凸包,所以肯定是选一个点,然后从两端不断拓展出去,假设已经拓展[i , i+len ]这几个点,且f[ i ][ len ][0]为遍历这些点,且终点为i的最短路,f[ i ] [len] [1]为遍历这些点,且终点为i+len的最短路,那么有原创 2013-05-18 20:43:56 · 2519 阅读 · 0 评论 -
vijos 1014 旅行商简化版(多路DP)
地址:https://vijos.org/p/1014题意:旅行商问题,不过要求只能单向走,就是有n个地方,要求从西往东,到最东面的地方,在从东往西返回,经过每个点一次,求最短路径分析:由于有了方向的限制,这题不再是NP难题,我们可以假设有两个人一起从西往东走,走过的点不能重复,这样就有f[ i ][ j ]表示第一个人走到i,第二个人走到j 的最短路径,要求i最后,预处理f[ 0 ]原创 2013-05-07 10:17:08 · 2453 阅读 · 0 评论 -
vijos 1002 过河(一类压缩长度的DP)
地址:https://vijos.org/p/1002题意:一条直线上有m个点,青蛙一次能跳的长度为s~t,每个点的坐标范围1~10^9,1分析:这题一下子就能想到简单的DP,f[ i ] =min{ f[ j +k ] }+w (s<=k<=t, w为i坐标是否有石子),这样的复杂度是O(L*t)的,主要时间都在L上,由于石头数m比较少,我们应该会发现,实际上有许多石头相隔很远,这之间原创 2013-05-06 14:42:50 · 1618 阅读 · 0 评论 -
hdu 4303 Hourai Jeweled(树型DP+统计答案)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=4303题意:给你一颗树,每个节点有权值,每条边有颜色,问所有满足相邻边颜色不同的路径的权值之和分析:一开始看成求权值最大的路径,所以就是水题了,不过加个统计就得略想一下子,f[ i ]表示i的所有子节点的连到i 路径和,这里有个限制就是i到子节点的颜色与i到父节点的颜色不同,g[ i ]记录相应的边原创 2013-05-31 09:22:54 · 2775 阅读 · 1 评论 -
我的DP训练情结(starting...)
整理原因:由于高中参加Noip时,主要做的题目都是些DP,搜索,还有一堆杂题,自从开始ACM生涯之后,发现不会的算法太多,于是专攻算法,然后就悲剧的发现,做题能力大大降低,我想没有练习这些DP,搜索还是不行的,从现在开始从新加强DP与搜索。。。从头开始,因为忘得太透彻了= =,纯属酱油,供雷同者参考。。。目的: 供自己全面复习,给后来者作为参照内容: 不具体讨论原创 2011-09-28 20:26:48 · 8118 阅读 · 21 评论 -
usaco 5.3 Big Barn(简单DP)
Big BarnA Special TreatFarmer John wants to place a big square barn on his square farm. He hates to cut down trees on his farm and wants to find a location for his barn that enables him to build原创 2012-09-25 15:39:57 · 733 阅读 · 0 评论 -
Zoj 3164 Cookie Choice(多重背包+分组背包,更新队列优化)
Cookie ChoiceTime Limit: 2 Seconds Memory Limit: 32768 KBMM enjoyed cookies very much. On Saint Valentine's Day, when she stepped into a big cookie store again, she wouldn't leave unless原创 2011-10-07 18:28:08 · 1937 阅读 · 0 评论 -
hdu 2993 MAX Average Problem(DP+斜率优化入门题)
MAX Average ProblemTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3800 Accepted Submission(s): 980Problem DescriptionConside原创 2012-09-16 11:02:19 · 1502 阅读 · 0 评论 -
bsoj 2430 HNOI2008 玩具装箱(DP+斜率优化)
【HNOI2008】玩具装箱 Time Limit:10000MS Memory Limit:65536KTotal Submit:288 Accepted:132 Case Time Limit:1000MSDescription P教授要去看奥运,但是他舍不下他的玩具,于是他决定把所有的玩具运到北京。他使用自己的压缩器进行压缩,其可以将任意物品变成一原创 2012-09-17 18:04:33 · 1389 阅读 · 0 评论 -
bsoj 2684 锯木场选址(DP+斜率优化)
【模拟试题】锯木场选址Time Limit:10000MS Memory Limit:65536KTotal Submit:464 Accepted:153 Case Time Limit:1000MSDescription 从山顶上到山底下沿着一条直线种植了n棵老树。当地的政府决定把他们砍下来。为了不浪费任何一棵木材,树被砍倒后要运送到锯木厂。原创 2012-09-17 15:03:04 · 1989 阅读 · 3 评论