题目传送门

 /*
BFS:三维BFS,坐标再加上步数,能走一个点当这个地方在步数内不能落到。因为雕像最多8步就会全部下落,
只要撑过这个时间就能win,否则lose
*/
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <cstring>
using namespace std; const int MAXN = ;
const int INF = 0x3f3f3f3f;
struct Point{
int x, y, step;
};
char maze[MAXN][MAXN];
bool vis[MAXN][MAXN][MAXN];
int n; bool check(int x, int y, int s) {
if (x >= && x <= && y >= && y <= && maze[x-s][y] != 'S') return true;
return false;
} bool BFS(void) {
queue<Point> Q; Q.push ((Point) {, , });
memset (vis, false, sizeof (vis)); while (!Q.empty ()) {
int x = Q.front ().x, y = Q.front ().y, s = Q.front ().step; Q.pop (); if (s > ) return true;
if (maze[x-s][y] == 'S') continue; for (int i=-; i<=; ++i) {
for (int j=-; j<=; ++j) {
int tx = x + i; int ty = y + j;
if (!check (tx, ty, s)) continue;
if (!vis[tx][ty][s+]) {
vis[tx][ty][s+] = true;
Q.push ((Point) {tx, ty, s + });
}
}
}
} return false;
} int main(void) { //Codeforces Beta Round #94 (Div. 2 Only) C. Statues
//freopen ("B.in", "r", stdin); n = ;
while (scanf ("%s", maze[] + ) == ) {
for (int i=; i<=n; ++i) {
scanf ("%s", maze[i] + );
} if (BFS ()) puts ("WIN");
else puts ("LOSE");
} return ;
}

最新文章

  1. Solr4.0 如何配置使用UUID自动生成id值
  2. http学习笔记(一)
  3. atitit.ajax bp dwr 3.的注解方式配置使用流程总结 VO9o.....
  4. activity跳转关闭软件盘
  5. Linux &amp; Python 导航目录
  6. 查看Oracle当前用户下的信息(用户,表视图,索引,表空间,同义词,存储过程函数,约束条件)
  7. Android的WiFi开启与关闭
  8. 读改善c#代码157个建议:建议10~12
  9. Android单元测试Junit (一)
  10. 洗礼灵魂,修炼python(73)--全栈项目实战篇(1)——【转载】前提准备之学习ubuntu
  11. MYeclipse 和 flex 环境配置
  12. angularjs学习第一天笔记
  13. 机器学习中的损失函数 (着重比较:hinge loss vs softmax loss)
  14. Docker镜像保存save、加载load
  15. office2016选择性安装
  16. Ubuntu 14.04 安装 SteamOS 会话
  17. FE英文缩写
  18. 【MVC】View与Control之间数据传递
  19. SpringBoot入门篇--对于JSON数据的返回以及处理二
  20. angular 程序架构

热门文章

  1. Python模块:logging、
  2. js判断对象是否为空对象的几种方法
  3. Layui选项卡、进度条、面板、徽章、时间线、辅助元素
  4. Mysql五大引擎之间的区别和优劣之分
  5. JSP点击计数器
  6. 【CV论文阅读】Unsupervised deep embedding for clustering analysis
  7. javascript 閉包
  8. Lint工具去除Android工程里不再需要的资源
  9. Grails边做边学入门篇[1]--------大家一起来动手建立project和Domain
  10. HNOI模拟 Day3.25 By Yqc