
状压DP
kalilili
双眼闭三年。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
UVA10817 Headmaster's Headache 状态压缩的01背包
题目地址:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1758题目意思:某校有n个教师和m个求职者。已知每人的工资和能教授的课程集合,要求支付最少的工资使得每门课都至少有两名教师教学。在职教师必须招聘思路:原创 2015-03-26 09:52:11 · 826 阅读 · 0 评论 -
Single Round Match 671 Round 1 - Division II, Level Three(状压DP)(略难)
题目链接:http://community.topcoder.com/stat?c=problem_statement&pm=14070&rd=16551大致题意:描述太麻烦。摘取关键题意:When pushing the trees, Limak always follows a few rules:He only pushes trees in two dire原创 2015-10-24 23:49:01 · 440 阅读 · 0 评论 -
LightOJ 1021 - Painful Bases(状压DP)
大致题意:求 ’0‘ ~ ‘F' 的排序,组成16进制数,能被K整除,求排列的方案数思路: 基础状压,注意从低位到高位DP,因为全是F在最高位时对于的十六进制会爆long long//#pragma comment(linker, "/STACK:1024000000,1024000000")#include #include #include #include #inc原创 2015-10-22 00:22:09 · 518 阅读 · 0 评论 -
HDU Untitled(状压DP OR dfs枚举子集)
UntitledTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 325 Accepted Submission(s): 169Problem DescriptionThere is an integer原创 2015-08-01 23:50:23 · 896 阅读 · 0 评论 -
Codeforces Round #191 (Div. 2) E. Axis Walking (状态压缩+lowbit应用)
E. Axis Walkingtime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputIahub wants to meet his girlfriend Iahubina原创 2015-07-30 10:41:00 · 868 阅读 · 0 评论 -
Topcoder SRM 663 Div2 Hard: CheeseRolling(状压DP)
Problem Statement N people (where N is a power of 2) are taking part in a single-elimination tournament in cheese rolling. The diagram below illustrates the structure of the tournament br原创 2015-08-08 17:16:17 · 1007 阅读 · 0 评论 -
Codeforces Round #141 (Div. 2) C. Fractal Detector(神奇的状压DP)(好题)
C. Fractal Detectortime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLittle Vasya likes painting fractals ve原创 2015-07-09 21:10:10 · 800 阅读 · 0 评论 -
UVA 1412 - Fund Management(用vector容器模拟状态的状压dp)
Frank is a portfolio manager of a closed-end fund for Advanced Commercial Markets (ACM ). Fund collects money (cash) from individual investors for a certain period of time and invests cash into variou原创 2015-04-13 19:33:42 · 1279 阅读 · 0 评论 -
POJ 3311-Hie with the Pie(floyd+TSP 状压DP)
题意:一个送外卖的人,要将外卖全部送去所有地点再回到店离,求最短路。(可以重复经过边)思路:由于可重复走某些边,所以先求各个点的最短路,再TSPdp[i][s] 表示目前在i点还需要遍历s集合后回到0点的最短路径边界条件就是dp[i][0]=dis[i][0]//196 KB 0 ms C++ 1190 B #include#include#include#include原创 2015-03-29 21:00:03 · 783 阅读 · 0 评论 -
POJ 1185 炮兵阵地 (状态DP--经典题)
本题的难度给跪了,完全不是自己的能力范围内,看了别人的解题报告才写的摘自http://blog.youkuaiyun.com/woshi250hua/article/details/7736045题目大意:给定一张n*m的地图,地图上有平原p,有山地h,可以在平原p打炮,俗称野战,打炮方向有四个,上下左右,射程是2,要求两个炮不能相互打到,问符合这个要求的情况最多打几个炮?n 解题思路:经原创 2015-03-29 09:26:30 · 755 阅读 · 0 评论 -
POJ 3254 Corn Fields (状压DP)
题意:一个n*m的矩阵,每个格子是0或者1,1表示土壤肥沃可以种植草地,0则不可以。在种草地的格子可以放牛,但边相邻的两个格子不允许同时放牛,问总共有多少种放牛的方法?(不放牛也算一种情况)思路:就是POJ 1185 炮兵阵地 的弱化版,炮兵那题相当于间隔两行,这里是间隔一行,减少一维坐标就可//192 KB 32 ms C++ 1221 B #include#incl原创 2015-03-29 22:00:24 · 686 阅读 · 0 评论 -
UVA 1252 - Twenty Questions(状态压缩DP+记忆化搜索)
题意:01特征串组成的物品,现在你可以询问一个位置的特征,对于每个东西如果为1回答YES,如果为0回答NO。那么如果你当前无法区分开每个东西,就可以继续问一个特征,现在要求最坏情况下,你需要询问几次的最少次数。思路:枚举询问的位置的所有可能,也就是枚举(1#include#include#include#includeusing namespace std;int m,n;in原创 2015-03-26 20:57:19 · 689 阅读 · 0 评论 -
Light OJ 1061 - N Queen Again(搜索+状压DP)
大致题意:8*8的棋盘,已知八个皇后的位置,问最少移动多少次,可以让八个皇后不互相攻击。(同行,同列,同斜线视为互相攻击)思路:易知八皇后不攻击一共有92种,dfs出这92种,然后对于每种状压求出最少需要移动多少次复杂度: O( 92 * n * 2 ^ n) (n = 8)//package ok;import java.math.*;import java.io原创 2015-10-30 10:53:14 · 725 阅读 · 0 评论