Uvaoj 11624 - Fire!】的更多相关文章

/************************************************************************* > File Name: test.cpp > Author: HJZ > Mail: 2570230521@qq.com > Created Time: 2014年08月03日 星期日 07时26分58秒 ****************************************************************…
UVa 11624 - Fire!(着火了!) Time limit: 1.000 seconds Description - 题目描述 Joe works in a maze. Unfortunately, portions of the maze have caught on fire, and the owner of the maze neglected to create a fire escape plan. Help Joe escape the maze. Given Joe’s…
题目传送门 /* BFS:首先对火搜索,求出火蔓延到某点的时间,再对J搜索,如果走到的地方火已经烧到了就不入队,直到走出边界. */ /************************************************ Author :Running_Time Created Time :2015-8-4 8:11:54 File Name :UVA_11624.cpp *************************************************/ #incl…
UVA - 11624 题意:joe在一个迷宫里,迷宫的一些部分着火了,火势会向周围四个方向蔓延,joe可以向四个方向移动.火与人的速度都是1格/1秒,问j能否逃出迷宫,若能输出最小时间. 题解:先考虑模拟火,肯定是bfs(每次把同一时间着火的格子pop出来,再将它们周围的格子的t加一push进去) 然后考虑怎么模拟人,现在人处在一个会变化的迷宫中.貌似很复杂. 我们可以考虑t时刻的地图(假设我们bfs人的位置),着火的地方相当于墙壁,已经走过的地方也相当于墙壁(因为不可能回到已经走过的地方,…
题目大意:在一个N*M的迷宫内,J代表某人(只有一个),F代表火(可能不只一个),#代表墙,火每分钟会向四周除了墙以外的地方扩散一层,问人能否在没被火烧到 之前逃出迷宫,若能逃出输出最短时间.很明显的bfs.但由于火到达的地方人不能抵达,故需先对火进行bfs,标记后若人在火烧到之前抵达即可.最后逃出时间需要加一, 因为当时只是抵达边界,若逃出时间需加一. #include <stdio.h> #include <queue> #include <string.h> #i…
Fire! Time Limit: 5000MS   Memory Limit: 262144KB   64bit IO Format: %lld & %llu Description Joe works in a maze. Unfortunately, portions of the maze have caught on fire, and the owner of the maze neglected to create a fire escape plan. Help Joe esca…
算法指南白书 分别求一次人和火到达各个点的最短时间 #include<cstdio> #include<cstring> #include<queue> #include<algorithm> using namespace std; ; + ; + ; int R, C; char maze[maxr][maxc]; struct Cell { int r, c; Cell(int r, int c):r(r),c(c) {} }; ,,,}; ,,-,}…
Description Joe works in a maze. Unfortunately, portions of the maze have caught on fire, and the owner of the maze neglected to create a fire escape plan. Help Joe escape the maze. Given Joe's location in the maze and which squares of the maze are o…
Joe works in a maze. Unfortunately, portions of the maze have caught on fire, and the owner of the maze neglected to create a fire escape plan. Help Joe escape the maze. Given Joe's location in the maze and which squares of the maze are on fire, you…
题意 有一个人 有一些火 人 在每一秒 可以向 上下左右的空地走 火每秒 也会向 上下左右的空地 蔓延 求 人能不能跑出来 如果能 求最小时间 思路 有一个 坑点 火是 可能有 多处 的 样例中 只有一处 然后 先让 火 蔓延 再让人走 BFS AC代码 #include <cstdio> #include <cstring> #include <ctype.h> #include <cstdlib> #include <cmath> #incl…