hdu1072 Nightmare---BFS】的更多相关文章

Nightmare Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other) Total Submission(s) : 4   Accepted Submission(s) : 3 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description Ignatius had a nightmare last…
Nightmare Problem Description Ignatius had a nightmare last night. He found himself in a labyrinth with a time bomb on him. The labyrinth has an exit, Ignatius should get out of the labyrinth before the bomb explodes. The initial exploding time of th…
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1072 Description Ignatius had a nightmare last night. He found himself in a labyrinth with a time bomb on him. The labyrinth has an exit, Ignatius should get out of the labyrinth before the bomb explodes.…
Nightmare Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 5795    Accepted Submission(s): 2868 Problem Description Ignatius had a nightmare last night. He found himself in a labyrinth with a ti…
Ignatius had a nightmare last night. He found himself in a labyrinth with a time bomb on him. The labyrinth has an exit, Ignatius should get out of the labyrinth before the bomb explodes. The initial exploding time of the bomb is set to 6 minutes. To…
题意:在一个地图里逃亡,2是起点,3是终点,1是路,0是墙,逃亡者携带一个炸弹,6分钟就会炸,要在6分钟前到达4可以重制时间,问是否能逃亡,若能则输出最小值 我的思路:bfs在5步内是否存在3,存在则输出退出.记录到达每一点剩余时间,如果再次到达某点的剩余时间大于原剩余时间则更新,加入队列. #include <iostream> #include <cstring> #include <queue> using namespace std; ; int map[M][…
题目链接:Nightmare 题意: 给出一张n*m的图,0代表墙,1代表可以走,2代表起始点,3代表终点,4代表炸弹重置点 问是否能从起点到达终点 分析: 一道很好的DFS题目,炸弹重置点必然最多走一次,可能会陷入无限递归,故有一个重要的剪枝,见代码, 此题采用记忆化搜索(不懂の),注意代码的设计思路 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; ][],step…
http://acm.hdu.edu.cn/showproblem.php?pid=1072 遇到Bomb-Reset-Equipment的时候除了时间恢复之外,必须把这个点做标记不能再走,不然可能造成死循环,也得不到最优解. #include <cstdio> #include <cstring> #include <queue> using namespace std; struct point { int x,y,time,step; }; point s; in…
传送门 题意 给出一张n*m的图 0.墙 1.可走之路 2.起始点 3.终点 4.时间重置点 问是否能到达终点 分析 我的训练专题第一题,一开始我设个vis数组记录,然后写炸,不能处理重置点根vis的关系,然后看了iaccepted这篇blog,换了一种思路,加了一个很好的剪枝,0ms过,足可显示我的搜索思想差.实现差,切记!切记! trick 1.dfs不能保证最先到达终点的为最短距离,不能打标记 2.剪枝说明:如果当前到达该点时间少于该点剩余时间并且步数大于该点步数,则返回 代码 #incl…
Nightmare Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 5647    Accepted Submission(s): 2808 Problem Description Ignatius had a nightmare last night. He found himself in a labyrinth with a ti…