zoj 1649 Rescue (BFS)(转载)】的更多相关文章

又是类似骑士拯救公主,不过这个是朋友拯救天使的故事... 不同的是,天使有多个朋友,而骑士一般单枪匹马比较帅~ 求到达天使的最短时间,杀死一个护卫1 units time , 走一个格子 1 unit time .SO,杀死一个护卫到达那个格子 2units time. 第一反应是广搜,就搜咧 = =.. WA了,交hdu上 AC了,hdu数据真弱啊... 想了想,想通了,因为一般广搜的话必须都是1个时间才能搜,才能保证这个BFS树是等距离向外伸展的,而这个不是等距离的,所以需要一些处理. 1.…
题意 求迷宫中从a的位置到r的位置须要的最少时间  经过'.'方格须要1s  经过'x'方格须要两秒  '#'表示墙 因为有1s和2s两种情况  须要在基础迷宫bfs上加些推断 令到达每一个点的时间初始为无穷大  当从一个点到达该点用的时间比他本来的时间小时  更新这个点的时间并将这个点入队  扫描全然图就得到答案咯 #include<cstdio> #include<cstring> #include<queue> using namespace std; const…
BFS..第一次使用C++ STL的队列来写广搜. #include<stdio.h> #include<string.h> #include<math.h> #include<queue> #include<algorithm> using namespace std; ; struct Point{ int time, x, y; }; queue<Point> Q; char mapp[maxn][maxn]; int mt[m…
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1649 //hnldyhy(303882171) 11:12:46 // zoj 1649 //bfs +优先队列 #include <stdio.h> #include <iostream> #include <queue> using namespace std; struct node { int x; int y; int step; };…
Rescue Time Limit: 2 Seconds      Memory Limit: 65536 KB Angel was caught by the MOLIGPY! He was put in prison by Moligpy. The prison is described as a N * M (N, M <= 200) matrix. There are WALLs, ROADs, and GUARDs in the prison. Angel's friends want…
题目链接 ZOJ链接 Problem Description Angel was caught by the MOLIGPY! He was put in prison by Moligpy. The prison is described as a N * M (N, M <= 200) matrix. There are WALLs, ROADs, and GUARDs in the prison. Angel's friends want to save Angel. Their task…
Rescue Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 521    Accepted Submission(s): 217   Problem Description Angel was caught by the MOLIGPY! He was put in prison by Moligpy. The prison is d…
Angel was caught by the MOLIGPY! He was put in prison by Moligpy. The prison is described as a N * M (N, M <= 200) matrix. There are WALLs, ROADs, and GUARDs in the prison. Angel's friends want to save Angel. Their task is: approach Angel. We assume…
Rescue Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 12927    Accepted Submission(s): 4733 Problem Description Angel was caught by the MOLIGPY! He was put in prison by Moligpy. The prison is d…
看题传送门: ZOJ http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1649 HDU http://acm.hdu.edu.cn/showproblem.php?pid=1242 题目大意初始位置在r,要求到达a的地点,地图上"."通过需要1s,"x"代表守卫,通过耗时2s,"#"不能走. BFS的应用. BFS求最短路径的原理是每一次向外扩张一格,(就像树的层次遍历一样…