题意:一张n*m的网格内每个点有话费,还有若干个宝藏,问一个人要走进去拿走所有宝藏在走出来的最小花费。思路:看宝藏只有13个直接想到了状压dp[i][j]拿了哪几个前一个为j的最小花费,先bfs+优先队列预处理出最短路,然后记忆化搜索就可。代码如下:
1 /********************....
分类:
其他好文 时间:
2014-05-19 23:26:38
阅读次数:
352
Problem Description
Acmers have been the Earth Protector against the evil enemy for a long time, now it’s your turn to protect our home.
There are 2 * n enemies in the map. Your task is to clear a...
分类:
其他好文 时间:
2014-05-13 11:29:40
阅读次数:
308
首先是CDQ《基于连通性状态压缩的动态规划问题》论文上的题目:URAL 1519
Formula 1 #include 2 #include 3 #include 4 using namespace std; 5 const int maxn
= 15; 6 const int H...
分类:
其他好文 时间:
2014-05-12 08:14:39
阅读次数:
433
Card Collector
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2141 Accepted Submission(s): 1008
Special Judge
Problem Description
...
分类:
其他好文 时间:
2014-05-11 02:25:56
阅读次数:
391
题意:坐飞机从 a 地到 b 地 ,在最多停留s次时 , 最小花费是多少?
在题目给出的地点 , 是按从远到近给出的 , 并且给出的航班中 , 不会有从远地点到近地点的航班。
因此从这可以看出 , 题目给的图是一个DAG图 , 那么我们就能用toposort来找最短路。
注意: 会有重边
解法:
构造一个数组 d[i][j] , 表示从开始点 s 到点 i...
分类:
其他好文 时间:
2014-05-10 08:51:56
阅读次数:
391
Description
Given a map of islands and bridges that connect these islands, a Hamilton path, as we all know, is a path along the bridges such that it visits each island exactly once. On our map, there...
分类:
其他好文 时间:
2014-05-07 13:04:35
阅读次数:
402
Problem Description
Ignatius再次被魔王抓走了(搞不懂他咋这么讨魔王喜欢)……
这次魔王汲取了上次的教训,把Ignatius关在一个n*m的地牢里,并在地牢的某些地方安装了带锁的门,钥匙藏在地牢另外的某些地方。刚开始Ignatius被关在(sx,sy)的位置,离开地牢的门在(ex,ey)的位置。Ignatius每分钟只能从一个坐标走到相邻四个坐标中的其中一个。魔王...
分类:
其他好文 时间:
2014-05-07 06:40:06
阅读次数:
269
Description
Farmer John has purchased a lush new rectangular pasture composed of M by
N (1 ≤ M ≤ 12; 1 ≤ N ≤ 12) square parcels. He wants to grow some yummy corn for the cows on a number of square...
分类:
其他好文 时间:
2014-05-07 05:46:43
阅读次数:
323
Description
Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his 'toilet series' (where he had to use his toilet paper to draw on,...
分类:
其他好文 时间:
2014-05-07 05:16:29
阅读次数:
385
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4628
一道典型的状态压缩DP。。。也是想了好久又经过大神的提示才想出来的,马上要比赛了,然后又遇到点了情感方面的问题。。。真是作死的节奏。。。悲催的程序员命。。。不多说了,看题。。。
Pieces
Time Limit: 6000/3000 MS (Java/Others) ...
分类:
其他好文 时间:
2014-05-06 23:34:39
阅读次数:
466