zoj 1649 bfs】的更多相关文章

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…
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; };…
题目链接 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…
又是类似骑士拯救公主,不过这个是朋友拯救天使的故事... 不同的是,天使有多个朋友,而骑士一般单枪匹马比较帅~ 求到达天使的最短时间,杀死一个护卫1 units time , 走一个格子 1 unit time .SO,杀死一个护卫到达那个格子 2units time. 第一反应是广搜,就搜咧 = =.. WA了,交hdu上 AC了,hdu数据真弱啊... 想了想,想通了,因为一般广搜的话必须都是1个时间才能搜,才能保证这个BFS树是等距离向外伸展的,而这个不是等距离的,所以需要一些处理. 1.…
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…
题意 求迷宫中从a的位置到r的位置须要的最少时间  经过'.'方格须要1s  经过'x'方格须要两秒  '#'表示墙 因为有1s和2s两种情况  须要在基础迷宫bfs上加些推断 令到达每一个点的时间初始为无穷大  当从一个点到达该点用的时间比他本来的时间小时  更新这个点的时间并将这个点入队  扫描全然图就得到答案咯 #include<cstdio> #include<cstring> #include<queue> using namespace std; const…
Mission Impossible Time Limit: 2 Seconds                                     Memory Limit: 65536 KB                                         Now a spy is besieged in a maze. He knows that there is a telegraph transmitter  in the maze somewhere. So he…
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…
#include <iostream> #include <queue> using namespace std; int n,m,s2,e2; int b[205][205],d[4][2]={{1,0},{-1,0},{0,1},{0,-1}}; char a[205][205]; struct point{ int x,y,step; }p; queue <point> q; int bfs(point pp) { int i,j,k; point t; q.pu…
赛后总结: TJ:今天我先到实验室,开始看题,一眼就看了一道防AK的题目,还居然觉得自己能做wwww.然后金姐和彭彭来了以后,我和他们讲了点题目.然后金姐开始搞dfs,我和彭彭看榜研究F题.想了很久脑子都炸了,做不下去了.然后在等金姐做完以后,彭彭说了D题题意,然后金姐开始写另外一道搜索题.做完两道搜索以后,金姐让我写那道线段树的题目.我搞了很久...然后超时了,因为要用素数筛,然后加了素数筛也做不出呜呜.金姐和彭彭把Ant的题目公式给搞出来了.开始敲.后来是因为取模的问题,就一直没搞成功.比赛…