码迷,mamicode.com
首页 >  
搜索关键字:状压    ( 1865个结果
poj 2923 状压dp+01背包
好牛b的思路题意:一系列物品,用二辆车运送,求运送完所需的最小次数,两辆车必须一起走解法为状态压缩DP+背包,本题的解题思路是先枚举选择若干个时的状态,总状态量为1 2 #include 3 #include 4 #include 5 #include 6 using namespace std; ...
分类:其他好文   时间:2015-03-19 23:48:11    阅读次数:218
BZOJ1087:[SCOI2005]互不侵犯King(状压DP)
[SCOI2005]互不侵犯KingDescription在N×N的棋盘里面放K个国王,使他们互不攻击,共有多少种摆放方案。国王能攻击到它上下左右,以及左上左下右上右下八个方向上附近的各一个格子,共8个格子。Input只有一行,包含两个数N,K ( 1 0 do begin a[x,c]...
分类:其他好文   时间:2015-03-17 00:34:20    阅读次数:162
HDU3681 Prison Break(状压dp)
Problem Description Rompire is a robot kingdom and a lot of robots live there peacefully. But one day, the king of Rompire was captured by human beings. His thinking circuit was changed by human and ...
分类:其他好文   时间:2015-03-16 14:39:22    阅读次数:158
2015广东工业大学ACM校赛 I 游戏王 (状压dp)
Problem I: 游戏王 Description 小学的时候,Stubird非常喜欢玩游戏王,有一天,他发现了一个绝佳的连锁组合,这个连锁组合需要6张卡, 可是他一张都没有,但是他的那些朋友们有,不过当然,他们不会白给,不过也不排除有人和他交情好,送给他了。 不过他们有成全别人的美德,当他们看到Stubird已经有某些他们喜欢的卡的时候,他们会给他优惠,或者更贵也说不定 嘛...
分类:其他好文   时间:2015-03-16 14:38:29    阅读次数:170
CF417D--- Cunning Gena(排序+状压dp)
A boy named Gena really wants to get to the “Russian Code Cup” finals, or at least get a t-shirt. But the offered problems are too complex, so he made an arrangement with his n friends that they will s...
分类:编程语言   时间:2015-03-16 14:36:02    阅读次数:141
COdeforces#417D Cunning Gena(状压DP)
A boy named Gena really wants to get to the "Russian Code Cup" finals, or at least get a t-shirt. But the offered problems are too complex, so he made an arrangement with his n friends that they wil...
分类:其他好文   时间:2015-03-15 23:05:06    阅读次数:277
poj 2688 状态压缩dp解tsp
题意: 裸的tsp。 分析: 用bfs求出任意两点之间的距离后可以暴搜也可以用next_permutation水,但效率肯定不如状压dp。dp[s][u]表示从0出发访问过s集合中的点,目前在点u走过的最短路程。 代码: //poj 2688 //sep9 #include #include using namespace std; const int maxW=32; const ...
分类:其他好文   时间:2015-03-15 10:57:59    阅读次数:153
[状压dp]POJ1185 炮兵阵地
中文题 题意不再赘述对于中间这个“P” 根据dp的无后效性 我们只需考虑前面的就变成了 只需考虑:也就是状压前两行具体与HDOJ的4539类似: 看HDOJ 4539仅仅是共存状态的判断不同 1 //#include 2 #include 3 #include 4 #include 5 #i...
分类:其他好文   时间:2015-03-15 10:51:18    阅读次数:229
[状压dp]HDOJ4539 郑厂长系列故事——排兵布阵
中文题,题意不再赘述对于“?”这一格,它所能攻击到的(曼哈顿距离为2的) 前方的 即“√”的四个位置那么与此格有关的即它前方两行(即状压这两行)首先预处理每行能满足的:i 和(i<<2)不能同时放然后分别枚举前一行和再前一行的所有状态(每一行的状态至多只有2^10=1024个) 判断能否共存注意mp...
分类:其他好文   时间:2015-03-15 10:43:17    阅读次数:132
ZOJ 3471 Most Powerful(状压dp)
Recently, researchers on Mars have discovered N powerful atoms. All of them are different. These atoms have some properties. When two of these atoms collide, one of them disappears and a lot of power ...
分类:其他好文   时间:2015-03-14 11:04:05    阅读次数:122
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!