
状态压缩
文章平均质量分 83
J_Sure
唯苦修深思方能顿悟
展开
-
HDU-OJ-1429 胜利大逃亡(续)
胜利大逃亡(续)Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionIgnatius再次被魔王抓走了(搞不懂他咋这么讨魔王喜欢)……这次魔王汲取了上次的教训,把Ignatius关在一个n*m的地牢里,并在地牢的某些地方安原创 2014-03-11 22:37:05 · 1039 阅读 · 0 评论 -
【汉密尔顿、DP|状态压缩】POJ-2288 Islands and Bridges
给出n个点,m条边。每个点有一个权值w。找出一条汉密尔顿路径,使它的值最大。一条汉密尔顿路径的值由三部分组成:1) 路径上每个点的权值之和2) 路径上每条边u-v,将其权值的积累加起来。即w[u]*w[v]3) 如果三个点形成一个三角形,例如i、i+1、i+2,那么将w[i]*w[i+1]*w[i+2]累加起来一条汉密尔顿路径可能包含多个三角形,一张图中也可能包含多个最好的汉密尔顿路径。输出最大的汉密尔顿路径的值,以及这样的汉密尔顿路径的个数。同一条汉密尔顿路径的两种走法算作一种。原创 2015-02-03 23:15:14 · 2348 阅读 · 0 评论 -
POJ-1351 Number of Locks
Number of LocksTime Limit: 1000MS Memory Limit: 10000K DescriptionIn certain factory a kind of spring locks is manufactured. There are n slots (1 < n < 17, n is原创 2014-05-04 22:45:38 · 1223 阅读 · 0 评论 -
【DFS】AHU-448 有趣的矩阵
AHU-448 有趣的矩阵: http://icpc.ahu.edu.cn/OJ/Problem.aspx?id=448题意:给出N行M列的1组成的矩阵,找出这样一个M列的子矩阵,它的每一列有且仅有一个'1'。前言:对DFS没有清晰的掌握,很难做对这一题!原创 2014-11-30 00:35:30 · 1175 阅读 · 0 评论 -
POJ-2404 Jogging Trails (中国邮递员)
Jogging TrailsTime Limit: 1000MS Memory Limit: 65536K DescriptionGord is training for a marathon. Behind his house is a park with a large network of jogging tra原创 2014-09-13 21:18:06 · 1537 阅读 · 0 评论 -
HDU-4352 XHXJ's LIS
XHXJ's LISTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Problem Description..................Another hobby of xhxj is yy(speculation) some magical prob原创 2014-08-21 20:58:22 · 970 阅读 · 0 评论 -
Codeforces-258B Little Elephant and Elections
B. Little Elephant and Electionstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere have recently been elections i原创 2014-08-22 23:28:10 · 992 阅读 · 0 评论 -
HDU-3709 Balanced Number
Balanced NumberTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Problem DescriptionA balanced number is a non-negative integer that can be balanced if a pi原创 2014-08-21 14:13:52 · 755 阅读 · 0 评论 -
SPOJ-BALNUM Balanced Numbers
10606. Balanced NumbersProblem code: BALNUMBalanced numbers have been used by mathematicians for centuries. A positive integer is considered a balanced number if:1) Every even digit appea原创 2014-08-21 10:11:31 · 1290 阅读 · 0 评论 -
Round #55 D. Beautiful numbers
D. Beautiful numberstime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVolodya is an odd boy and his taste is原创 2014-08-19 15:42:53 · 919 阅读 · 0 评论 -
POJ-2935 Basic Wall Maze
Basic Wall MazeTime Limit: 1000MS Memory Limit: 65536K Special JudgeDescriptionIn this problem you have to solve a very simple maze consisting of: a 6 by原创 2014-08-05 10:20:29 · 761 阅读 · 0 评论 -
HDU-OJ-2553 N皇后问题(打表/位运算)
N皇后问题Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Problem Description在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。你的任务是,对于给定原创 2014-04-13 00:38:27 · 1980 阅读 · 0 评论 -
AOJ-AHU-OJ-453 棋盘问题(位压缩)
上次我们DFS解决了棋盘问题。但是一跑……140+ms QAQ 看到别人20+ms AC了,深感愧疚。这次我们对棋盘问题的解决方式做空间和时间上的优化。让它优美地AC1.考虑空间问题。我们把棋盘作为地图保存了下来。有的地方是0可以放置棋子,有的地方是-1不能放置棋子。而且还做了每列的标记,放了棋子则该标记为1。我们发现,0/1 这个计算机唯一认识的两个符号是解决该问题的关键。“位运算”原创 2014-03-11 20:41:57 · 1155 阅读 · 0 评论 -
【DP|状态压缩+预处理】POJ-1185 炮兵阵地
给出地图,上面有些位置可以防止大炮,有些不能放,大炮可以攻击其上下左右两个格子的距离,要使大炮不互相攻击,最多可以安放多少门大炮。原创 2015-03-22 17:18:26 · 1126 阅读 · 2 评论