STL bfs
twh233
嘻嘻
展开
-
模版 BFS二维poj 1979
/* _...---.._ ,' ~~"--.. / ~"-._ / ~-. / . `-. \ -.\原创 2016-12-20 00:06:37 · 202 阅读 · 0 评论 -
肿瘤诊断 L3-004
点击打开链接题目链接如上:原创 2017-03-06 22:52:28 · 247 阅读 · 0 评论 -
poj 3984
迷宫问题Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 20998 Accepted: 12293Description定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0原创 2017-04-24 18:13:59 · 194 阅读 · 0 评论 -
codeforces 793B - Igor and his way to work(bfs)
传送真菜啊,最近连个bfs都不会写了。这个就是bfs从起点看能不能到达终点。只不过限制条件有点多。1.其中一个状态就是当前点还能转几次弯。最开始的自然是能转两次。2.一个状态就是当前点的方向。所以vis标记数组出了横纵坐标外,应该还有上面说的那两维。确定好这个之后就是一个简单的bfs可到达问题了。B. Igor and his way转载 2017-05-24 16:30:25 · 448 阅读 · 0 评论 -
胜利大逃亡(续)
传送门胜利大逃亡(续)Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9005 Accepted Submission(s): 3244Problem DescriptionIgnatius原创 2017-07-16 16:39:11 · 274 阅读 · 0 评论 -
poj 1915 BFS
My code:#include#include#define MAX 305using namespace std;struct point{ int x,y; int step;};//到达的点,和需要的步数 int dx[8]={-2,-2,-1,-1,1,1,2,2};int dy[8]={1,-1,2,-2,2,-2,1,-1};b原创 2016-12-20 00:11:19 · 213 阅读 · 0 评论 -
Codeforces Round #442 (Div. 2) P - Olya and Energy Drinks bfs +方向优化
传送门题意:给出一张n*m的地图,给定起点和终点,一个人从起点出发,每一秒内能向一个方向走1~k中的任意步数,问从起点到终点最少需要花费的时间,如果不能到达,则输出-1。做法:对vis[x][y]标记数组再多加一维方向即可。/// .-~~~~~~~~~-._ _.-~~~~~~~~~-.///原创 2017-10-25 13:35:36 · 193 阅读 · 0 评论 -
VK Cup 2017 - Qualification 1 C. Cycle In Maze
传送门Examplesinput2 3 2.**X..outputRLinput5 6 14..***.*...X...*.....*.**....*.outputDLDDLLLRRRUURUinput3 3 4****X****output原创 2017-10-25 22:33:23 · 293 阅读 · 1 评论