E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
【状态压缩】
poj2411
状态压缩
dp训练2——A
DescriptionSquaresandrectanglesfascinatedthefamousDutchpainterPietMondriaan.Onenight,afterproducingthedrawingsinhis'toiletseries'(wherehehadtousehistoiletpapertodrawon,forallofhispaperwasfilledwithsqu
yuanjunlai141
·
2016-03-24 10:00
UVA 11825【
状态压缩
】
题意:有一个由编号0~n-1的n台计算机组成的网络,一共有n种服务,每台计算机上都运行着全部服务,对于每台计算机,你可以选择停止一项服务,这个行为会导致与这台计算机和与他相连的其他计算机上的这项服务都停止(原来已经停止的继续保持停止状态)。求最多能使多少个服务瘫痪(即没有任何一台计算机在运行这项服务)。分析:用2进制表示每台电脑的集合有哪些电脑a[i],将这些集合用位运算求出若干a[i]的并集。最
u012483216
·
2016-03-23 22:00
hdoj-1044 Collect More Jewels 这题对我来说有点难..
参考博客:http://www.xuebuyuan.com/2176887.html第一种方法:BFS+
状态压缩
:(700+ms)#include#include#include#include#includeusingnamespacestd
寻找小海螺
·
2016-03-23 20:01
HDU 4403 A very hard Aoshu problem (暴力+
状态压缩
)
ProblemDescriptionAoshuisverypopularamongprimaryschoolstudents.Itismathematics,butmuchharderthanordinarymathematicsforprimaryschoolstudents.TeacherLiuisanAoshuteacher.Hejustcomesoutwithaproblemtotesth
u010850027
·
2016-03-23 16:00
HDU 5025图论之BFS
走到T时收集m把不同的钥匙,但是规定收集n之前,必须1~n-1全部收集完毕,怪最多有5个思路:怪最多就有5个,然后钥匙是1~9把,我们每个点的状态就不会很多,在BFS时每个点的状态进行标记就行了,5个怪
状态压缩
着判断
Dan__ge
·
2016-03-23 16:00
ACM
图论
HDU
bfs
HDU 5025图论之BFS
走到T时收集m把不同的钥匙,但是规定收集n之前,必须1~n-1全部收集完毕,怪最多有5个思路:怪最多就有5个,然后钥匙是1~9把,我们每个点的状态就不会很多,在BFS时每个点的状态进行标记就行了,5个怪
状态压缩
着判断
Dan__ge
·
2016-03-23 16:00
ACM
图论
HDU
bfs
POJ 2965 The Pilots Brothers' refrigerator【BFS+状压 Or 脑洞】
代码:bfs+
状态压缩
很容易想到~~这里的
状态压缩
要需要多加小心,注意一下存储的是翻转门的情况~#include #include #include usingnamespacestd; typedefpairp
Yukizzz
·
2016-03-22 23:00
POJ 2965 The Pilots Brothers' refrigerator【BFS+状压 Or 脑洞】
代码:bfs+
状态压缩
很容易想到~~这里的
状态压缩
要需要多加小心,注意一下存储的是翻转门的情况~#include #include #include usingnamespacestd; typedefpairp
Yukizzz
·
2016-03-22 23:00
bzoj1725: [Usaco2006 Nov]Corn Fields牧场的安排
分析:裸的
状态压缩
DP。
Fsss_7
·
2016-03-22 21:00
uva11825Hackers' Crackdown
剩下就是
状态压缩
了。O(3^n)代码:#include #include #include #include #include #i
Fsss_7
·
2016-03-21 22:00
poj2411(
状态压缩
dp)
Mondriaan'sDreamTimeLimit: 3000MS MemoryLimit: 65536KTotalSubmissions: 14198 Accepted: 8191DescriptionSquaresandrectanglesfascinatedthefamousDutchpainterPietMondriaan.Onenight,afterproducingthedrawing
martinue
·
2016-03-21 21:00
dp
ACM
大二
状态压缩
dp入门题 poj3254
本博客是在写的很菜,如若看不懂,可以参看http://www.tuicool.com/articles/JVzMVj,很棒这道题是一道入门的
状态压缩
dp,题目大意是农夫有一块地,被划分为m行n列大小相等的格子
zcmartin2014214283
·
2016-03-21 21:00
dp
poj
状态压缩dp
ZOJ 1100 Mondriaan's Dream【
状态压缩
】【DP】【DFS】
题目链接http://www.icpc.moe/onlinejudge/showProblem.do?problemId=100思路题意很简单,给你个h*w的格子,让你用2*1的长方形去填满它,问有几种填法。题意简单不代表好写啊,这TM怎么搞。。。比赛时想破脑子也只能想个暴力出来,妥妥TLE。后来搜了下题解终于做出来了,是状压DP+dfs。这是我第二次碰到搜索和状压组合的题目了,但状压+DP+搜索
wlx65003
·
2016-03-21 20:00
ACM
POJ-3279-Fliptile【
状态压缩
】【DFS】【好题】
POJ-3279-FliptileTimeLimit:2000MSMemoryLimit:65536KB DescriptionFarmerJohnknowsthatanintellectuallysatisfiedcowisahappycowwhowillgivemoremilk.Hehasarrangedabrainyactivityforcowsinwhichtheymanipulatean
loy_184548
·
2016-03-21 20:00
poj
DFS
状态压缩
3279
hdu4758(AC自动机+
状态压缩
dp)
链接:点击打开链接题意:在一个矩阵内从左上角走到右下角,向右走得到一个R向下走得到一个D,问最后有几种走到右下角时得到的字符串包含题中给出的两个字符串代码:#include #include #include #include #include #include usingnamespacestd; constintMOD=1000000007; intq[205],dp[105]
u010850027
·
2016-03-19 23:00
源码
动态规划
ACM
poj
hdu4057(AC自动机+
状态压缩
dp)
链接:点击打开链接题意:给出n段基因的价值和组成,求一个长度为l的价值大于零最大的基因价值代码:#include #include #include #include #include #include usingnamespacestd; constintINF=0x3f3f3f3f; intq[1005],dp[2][1005][(1<<10)+5]; intfail[100
u010850027
·
2016-03-19 22:00
源码
动态规划
ACM
hdu2825(AC自动机+
状态压缩
dp)
链接:点击打开链接题意:求一个长度是n的字符串至少含有给出的m个字符串中的k个的种数代码:#include #include #include #include #include #include usingnamespacestd; constintMOD=20090717; intdp[30][105][(1q; q.push(0); while(q.size()){ u
u010850027
·
2016-03-19 22:00
源码
动态规划
ACM
ZOJ 3596 Digit Number【
状态压缩
】【BFS】
首先是
状态压缩
,用十位二进制数表示选了哪些数,后面跟三位十进制数表示当前的数除以n的余数。然后用BFS保证位数递增,然后大循环里新加的数从小到大遍历,这
wlx65003
·
2016-03-19 21:00
二进制
ACM
bfs
bzoj1087: [SCOI2005]互不侵犯King
分析:因为n特别小,我们可以直接用
状态压缩
来表示每一行的状态,然后判断是否可行即可。PS:我的程序跑出来有点慢,应该是对于cal函数的多次计算的问题,其实我们可以预处理出来,然后每次O(1)调用即可。
Fsss_7
·
2016-03-19 17:00
ZOJ-2050-Flip Game【
状态压缩
bfs】
2050-FlipGameFlipgameisplayedonarectangular4x4fieldwithtwo-sidedpiecesplacedoneachofits16squares.Onesideofeachpieceiswhiteandtheotheroneisblackandeachpieceislyingeitherit’sblackorwhitesideup.Eachround
loy_184548
·
2016-03-18 21:00
ZOJ
2050
状态压缩bfs
八数码总结
参考来源:八数码的八境界方法1:暴搜+queue,如果空格用’0’表示的话可以直接将
状态压缩
成一个9位整数,也可以用字符串表示状态,用结构体表示状态+步数+空格的位置。代码:/*264137
Yukizzz
·
2016-03-18 11:00
hdu4758(ac自动机,
状态压缩
dp)
WalkThroughSquaresTimeLimit:4000/2000MS(Java/Others) MemoryLimit:65535/65535K(Java/Others)TotalSubmission(s):1136 AcceptedSubmission(s):356ProblemDescription Onthebeamingdayof60thanniversaryofN
martinue
·
2016-03-17 20:00
dp
ACM
大二
Hdu 4568 Hunter【spfa最短路 tsp
状态压缩
】
DescriptionOneday,ahunternamedJameswenttoamysteriousareatofindthetreasures.Jameswantedtoresearchtheareaandbroughtalltreasuresthathecould.TheareacanberepresentedasaN*Mrectangle.Anypointsoftherectanglei
zhou_yujia
·
2016-03-17 17:00
hdu4568(spfa,
状态压缩
dp)
HunterTimeLimit:2000/1000MS(Java/Others) MemoryLimit:32768/32768K(Java/Others)TotalSubmission(s):1668 AcceptedSubmission(s):501ProblemDescriptionOneday,ahunternamedJameswenttoamysteriousareatofi
martinue
·
2016-03-16 21:00
dp
ACM
大二
HOJ 2226&POJ2688 Cleaning Robot(BFS+TSP(
状态压缩
DP))
CleaningRobotTimeLimit:1000MSMemoryLimit:65536KTotalSubmissions:4264Accepted:1713DescriptionHere,wewanttosolvepathplanningforamobilerobotcleaningarectangularroomfloorwithfurniture.Considertheroomfloor
Dacc123
·
2016-03-16 16:00
hdu2852(ac自动机,
状态压缩
dp)
WirelessPasswordTimeLimit:2000/1000MS(Java/Others) MemoryLimit:32768/32768K(Java/Others)TotalSubmission(s):5524 AcceptedSubmission(s):1741ProblemDescriptionLiyuanlivesinaoldapartment.Oneday,hesu
martinue
·
2016-03-16 13:00
dp
ACM
AC自动机
大二
codechef CBAL
传送门:https://www.codechef.com/problems/CBAL思路:先求一遍出现次数前缀和,我们只管每个字母出现次数奇偶性,所以可以把
状态压缩
一下,离散化之后就只有最多n个状态对于子串
thy_asdf
·
2016-03-16 08:00
hdu2825Wireless Password【ac自动机+dp
状态压缩
】
TotalSubmission(s):5502 AcceptedSubmission(s):1737ProblemDescriptionLiyuanlivesinaoldapartment.Oneday,hesuddenlyfoundthattherewasawirelessnetworkinthebuilding.Liyuandidnotknowthepasswordofthenetwor
zhou_yujia
·
2016-03-15 17:00
hdu4057(ac自动机,
状态压缩
dp)
RescuetheRabbitTimeLimit:20000/10000MS(Java/Others) MemoryLimit:32768/32768K(Java/Others)TotalSubmission(s):1790 AcceptedSubmission(s):512ProblemDescriptionDr.Xisabiologist,wholikesrabbitsverymu
martinue
·
2016-03-15 14:00
dp
ACM
AC自动机
大二
[置顶] POJ DP题目合集
打星号的表示个人认为比较经典,或是算法比较好的题目 1014*Dividing 半个背包,注意中断,否则可能TLE1036Gangsters可以很水的DP过,还有多种优化的方法1038*BugsIntegrated,Inc.
状态压缩
BPM136
·
2016-03-14 16:00
题集
【HDU4085】Peach Blossom Spring【斯坦纳树】【
状态压缩
】
http://acm.hdu.edu.cn/showproblem.php?pid=4085裸的斯坦纳树。参考了凯爷blog:http://blog.csdn.net/lethelody/article/details/44808507/*FootprintsInTheBloodSoakedSnow*/ #include #include #include #include usingnames
BraketBN
·
2016-03-14 16:00
hdu 1074 Doing Homework
状态压缩
DP
由于n最大只有15,所以用
状态压缩
,从1到1 #include #include #include #defineN1>T; while(T--) { cin>>n; for(inti=0;i>a[i]
zchahaha
·
2016-03-13 09:00
dp
动态规划
C语言
HDU
状态压缩
hdu 3681(bfs+dfs+
状态压缩
)
解题思路:这道题属于图上来回走的问题,可以把重复走的过程弱化,即只强调从u->v的结果,中间经过的节点都不考虑。这道题里面'G','F','Y'是重要的节点,其余的点我们是可以忽略的,也就是说,假设从u->v,我们只需要知道最短路径是多少就可以了,至于是怎么走的,中间绕过了多少个'D'都不是我们关心的。这样我们就只需要用bfs找到'G','F','Y'两两之间的最短路径,剩下的就是一个典型的TSP
hexianhao
·
2016-03-10 16:00
搜索
状态压缩
ProblemCTimeLimit:3000/800ms(Java/Other) MemoryLimit:65535/32768K(Java/Other)TotalSubmission(s):64 AcceptedSubmission(s):11Font: TimesNewRoman | Verdana | GeorgiaFontSize: ← →ProblemDescription新年伊
acm_fighting
·
2016-03-06 19:00
NJOJ Hero
状态压缩
觉悟题
仅以此题纪念我为数不多的状压DP。题意:有n*n的矩阵,选择其中的n个,使得和最大。且n个中任意两个不得在同行或同列。n #include #include #include #include #include usingnamespacestd; #defineN20 inta[N][N],ans[65550]; intf[N]; intfind(intx) { intr=0; while(x)
Danliwoo
·
2016-03-06 18:00
dp
解题报告
状态压缩
状态压缩
(并查集的实现)
状态压缩
这个名字听起来好可怕啊,(看了大神的博客自己说话都变风格了),但其实只是一个简单的知识点,学起来轻松些就可以。
vector_M
·
2016-03-05 11:00
ZOJ 3777 11th省赛 B Problem Arrangement【
状态压缩
DP】
题目链接http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5264思路题意就是n个题目,第i个题目放到第j个位置的有趣值是p[i][j],问你随机排列使得有趣值总和大于等于m的期望值是多少。这个期望值很好算就是n!/cnt。直接dfs会超时,这里用到了DP,而DP的话,如果设dp[i][j]表示放了前i个题目,有趣值总和为j的方案
wlx65003
·
2016-03-04 22:00
ACM
hdu 4012(bfs+位压缩)
每次涂色以后必有一个格子的颜色是最终的颜色,否则这次涂色根本没意义,所以我们把每次涂色后哪些格子成为最终颜色的所有可能都入队,入队的元素是一个struct包含步数和最终颜色已确定的木块集合,这个集合必须用整数表示,所以用到
状态压缩
hexianhao
·
2016-03-03 20:00
搜索
UVA - 1252 Twenty Questions(
状态压缩
&记忆化搜索)
题目链接:UVA-1252TwentyQuestions题意有n(0思路从m的数据范围以及题意,很容易可以想到
状态压缩
,用二进制位来表示集合。
to_be_better
·
2016-03-02 22:00
dp
uva
POJ 1185炮兵阵地(
状态压缩
dp)
炮兵阵地TimeLimit:2000MS MemoryLimit:65536KTotalSubmissions:23094 Accepted:8948Description司令部的将军们打算在N*M的网格地图上部署他们的炮兵部队。一个N*M的地图由N行M列组成,地图的每一格可能是山地(用"H"表示),也可能是平原(用"P"表示),如下图。在每一格平原地形上最多可以布置一支炮兵部队(山地上不能够部署
zjw6463
·
2016-03-02 20:00
poj 3254Corn Fields(
状态压缩
dp)
CornFieldsTimeLimit:2000MS MemoryLimit:65536KB 64bitIOFormat:%I64d&%I64uSubmitStatusPracticePOJ3254Appointdescription:DescriptionFarmerJohnhaspurchasedalushnewrectangularpasturecomposedofMbyN(1≤
zjw6463
·
2016-03-01 21:00
poj2411Mondriaan's Dream(
状态压缩
dp)
Mondriaan'sDreamTimeLimit:3000MS MemoryLimit:65536KB 64bitIOFormat:%I64d&%I64uSubmitStatusPracticePOJ2411Appointdescription:DescriptionSquaresandrectanglesfascinatedthefamousDutchpainterPietMond
zjw6463
·
2016-03-01 14:00
POJ2686
状态压缩
dp
题目大意:n张票,m个城市,p条路,a是出发地,b是目的地,然后n张票上面都会有马的数目。从a走到b中,经过每条路都需要时间,并且一定要借助马。时间=路程/马的数量。问,如何走才能让时间最短(每张票只能使用一次)。挑战程序竞赛上的例题P193.代码我就弱弱的贴一下吧#include#include#include#includeusingnamespacestd;//n是票的数目,m是城市的数目,
zcj5027
·
2016-02-29 17:00
状态压缩
】
HoledoxMovingTimeLimit:5000MS MemoryLimit:65536KTotalSubmissions:14912 Accepted:3603DescriptionDuringwinter,themosthungryandseveretime,Holedoxsleepsinitslair.Whenspringcomes,Holedoxwakesup,movestothee
zhou_yujia
·
2016-02-28 19:00
uva10651
思路:位运算+记忆化搜索
状态压缩
代码:#include usingnamespacestd; #include #include constintMAXN=4100; intvis[MAXN],_min
vv494049661
·
2016-02-28 18:00
HDU 4352 XHXJ's LIS
---------------------------------------------------------------------------做这题前先要会$LIS$的单调数组&二分的做法这题
状态压缩
是很需要技巧的如果记录构成长度为
sagitta
·
2016-02-28 18:00
HDU1074(
状态压缩
DP)
DoingHomeworkTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):7070 AcceptedSubmission(s):3104ProblemDescriptionIgnatiushasjustcomebackschoolfromthe30thA
baneHunter
·
2016-02-28 10:00
hdu 1074 doing homework(
状态压缩
dp)
DescriptionIgnatiushasjustcomebackschoolfromthe30thACM/ICPC.Nowhehasalotofhomeworktodo.Everyteachergiveshimadeadlineofhandinginthehomework.IfIgnatiushandsinthehomeworkafterthedeadline,theteacherwillre
xiaojixuansu
·
2016-02-27 15:00
ACM知识点分类
完全没听说过黄:听说过绿:接触过做过题蓝:很熟悉刷过专题紫:见一道秒一道)第一类:基础算法(1) 基础算法:枚举,贪心,递归,分治,递推,构造,模拟(2) 动态规划:背包问题,树形dp,
状态压缩
syuritsu
·
2016-02-26 18:00
hdu3001 Travelling 三进制
状态压缩
dp
tsp类型,只是这里面的点最多可以访问2次。所以用一个来表示访问了多少次,正好是三进制。对于每个状态i,先处理出第j位为几,即num[i][j],方便使用。用dp[i][j]表示,状态i时,以j为终点的最小花费。然后是和tsp一样扩展下一个点。#include usingnamespacestd; constintinf=0x7fffffff; intd[12],num[60000][12],dp
xinag578
·
2016-02-26 15:00
上一页
18
19
20
21
22
23
24
25
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他