题目链接:poj 1204 Word Puzzles
题目大意:给定一个有字符组成的N行M列的矩阵,就这是Q次查询,每次查询包括一个字符串,要求在矩阵中找到起
始点以及方向。
解题思路:对查询建立字典树,然后暴力枚举矩阵中的起点和方向。数据有点弱,就这样给过了。
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn = 1e6+5;
const int maxc = 1005;
const int sigma_size = 26;
const int dir[8][2] = {{-1, 0}, {-1, 1}, {0, 1}, {1, 1}, {1, 0}, {1, -1}, {0, -1......
阅读全文