UVA 816 - Abbott's Revenge
题目链接
题意:一个迷宫,每个点限制了从哪一方向来的,只能往左右前走,然后问起点到终点的最短路径
思路:BFS,每个点拆成4个方向的点,对应能走的方向建图跑一下bfs即可
代码:
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
const int N = 10005;
const int D[4][2] = {-1, 0, 0, 1, 1, 0, 0, -1};
char name[25];
int n, m;
vector<int> g[15][15][4];
struct State {
in......
阅读全文