HDU3085 Nightmare Ⅱ[双向bfs]

HDU 3085 Nightmare Ⅱ(双向BFS) 题意   A、B在迷宫中,A每回合能走3步,B每回合能走1步,迷宫中还有2个鬼,每回合最先活动,会向两步内的格子分裂,A、B不能碰鬼,求他们最快见面的回合数 思路 ​ 题目中描述A能走3步,实际上意思是A每回合能移动[0,3]步,B也同理,所以只要考虑A、B尽可能最远到达的区域,在当前回合这些区域内都是可达的   将整个题目可以考虑为一个像染色的模型,A、B、鬼分别以每回合3、1、2的速度染色,... 阅读详情


D - Nightmare Ⅱ
Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u

Description

Last night, little erriyue had a horrible nightmare. He dreamed that he and his girl friend were trapped in a big maze separately. More terribly, there are two ghosts in the maze. They will kill the people. Now little erriyue wants to know if he could find his girl friend before the ghosts find them. 
You may suppose that little erriyue and his girl friend can move in 4 directions. In each second, little erriyue can move 3 steps and his girl friend can move 1 step. The ghosts are evil, every second they will divide into several parts to occupy the grids within 2 steps to them until they occupy the whole maze. You can suppose that at every second the ghosts divide firstly then the little erriyue and his girl friend start to move, and if little erriyue or his girl friend arrive at a grid with a ghost, they will die. 
Note: the new ghosts also can devide as the original ghost. 
 

Input

The input starts with an integer T, means the number of test cases. 
Each test case starts with a line contains two integers n and m, means the size of the maze. (1<n, m<800) 
The next n lines describe the maze. Each line contains m characters. The characters may be: 
‘.’ denotes an empty place, all can walk on. 
‘X’ denotes a wall, only people can’t walk on. 
‘M’ denotes little erriyue 
‘G’ denotes the girl friend. 
‘Z’ denotes the ghosts. 
It is guaranteed that will contain exactly one letter M, one letter G and two letters Z. 
 

Output

Output a single integer S in one line, denotes erriyue and his girlfriend will meet in the minimum time S if they can meet successfully, or output -1 denotes they failed to meet.
 

Sample Input

     
3 5 6 XXXXXX XZ..ZX XXXXXX M.G... ...... 5 6 XXXXXX XZZ..X XXXXXX M..... ..G... 10 10 .......... ..X....... ..M.X...X. X......... .X..X.X.X. .........X ..XX....X. X....G...X ...ZX.X... ...Z..X..X
 

Sample Output

     
1 1 -1
 

题意:

看M和G能不能在不遇到鬼的情况下,找到对方.

M一次可以走三步 G只能走一步 鬼可以走两步 



貌似用优先队列改了队列里面的顺序..不能用
改成队列就过了.

完全不知道为什么..不管了..

M的三步我用了一个leave去保存, 从0-2 到了2之后 就把该点的步数加一 放在队列里面

其余的 记得先比较跟鬼的距离,因为鬼是先走的,当前点如果和鬼的曼哈顿距离 小于2*step的话 , 就不能用该点 continue






#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<vector>
using namespace std;
const int N=810;
int n,m;
char Map[N][N];
bool mark[N][N][2],flag,used[N][N];
int dir[4][2]={{-1,0},{0,1},{1,0},{0,-1}};
struct node
{
    int x,y,step,leave;
}M,G,Z[2];
queue<node>q;
queue<node>p;
bool check(int x,int y,int num,int step)
{
    if (x<0 || x>=n || y<0 || y>=m || mark[x][y][num] || Map[x][y]=='X' || abs(x-Z[0].x)+abs(y-Z[0].y)<=2*step || abs(x-Z[1].x)+abs(y-Z[1].y)<=2*step)
        return 0;
    return 1;
}
bool check(int x,int y,int step)
{
    if (abs(x-Z[0].x)+abs(y-Z[0].y)<=2*step || abs(x-Z[1].x)+abs(y-Z[1].y)<=2*step)
        return 0;
    return 1;
}
int bfs()
{
    flag=0;
    while (!q.empty())
        q.pop();
    while (!p.empty())
        p.pop();
    q.push(M);
    p.push(G);
    int s=0;
    while (!q.empty() || !p.empty())
    {
        node start,later;
        while (!q.empty() && q.front().step<=s)
        {
            start=q.front();
            q.pop();
            if (!check(start.x,start.y,start.step+1))
                    continue;
            for (int i=0 ; i<4 ; i++)
            {
                int nx=start.x+dir[i][0];
                int ny=start.y+dir[i][1];
                if (check(nx,ny,0,start.step+1))
                {
                    if (mark[nx][ny][1])
                        return start.step+1;
                    mark[nx][ny][0]=1;
                    later.x=nx;
                    later.y=ny;
                    later.step=start.step;
                    if (start.leave==2)
                    {
                        later.leave=0;
                        later.step++;
                    }
                    else
                        later.leave=start.leave+1;
                    q.push(later);
                }
            }
        }
        while (!p.empty() && p.front().step<=s)
        {
            start=p.front();
            p.pop();
            if (!check(start.x,start.y,start.step+1))
                continue;
            for (int i=0 ; i<4 ; i++)
            {
                int nx=start.x+dir[i][0];
                int ny=start.y+dir[i][1];
                if (check(nx,ny,1,start.step+1))
                {
                    if (mark[nx][ny][0])
                        return start.step+1;
                    mark[nx][ny][1]=1;
                    later.x=nx;
                    later.y=ny;
                    later.step=start.step+1;
                    later.leave=start.leave;
                    p.push(later);
                }
            }
        }
        s++;
    }
    return -1;
}
int main()
{
    int T;
    scanf("%d",&T);
    while (T--)
    {
        scanf("%d%d",&n,&m);
        memset(mark,0,sizeof(mark));
        int z=0;
        for (int i=0 ; i<n ; i++)
        {
            scanf("%s",Map[i]);
            for (int j=0 ; j<m ; j++)
            {
                if (Map[i][j]=='M')
                {
                    M.x=i;
                    M.y=j;
                    M.leave=0;
                    mark[i][j][0]=1;
                    M.step=0;
                }
                else if (Map[i][j]=='G')
                {
                    G.x=i;
                    G.y=j;
                    G.leave=0;
                    mark[i][j][1]=1;
                    G.step=0;
                }
                else if (Map[i][j]=='Z')
                {
                    Z[z].x=i;
                    Z[z].y=j;
                    Z[z++].step=0;
                }
            }
        }
        printf("%d\n",bfs());
    }
    return 0;
}



/*
5 6
XXXXXX
XZZ..X
XXXXXX
M.....
..G...
5 6
XXXXXX
XZZ..X
XXXXXX
M.....
.XG...
5 6
XXXXXX
XZZ..X
XXXXXX
MG....
.X....

5 6
XXXXXX
XZZ..X
XXXXXX
M.X...
XX.XG.

*/


HDU 3085 Nightmare Ⅱ【双向bfs】 Nightmare Ⅱ Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3927    Accepted Submission(s): 1131   Problem Description Last night, little er... 阅读详情

相关推荐

基于LangGraph的智能报告生成平台项目分析

不知道你是否知道或者了解OpenAI and Gemini Deep Research。他们是一种能够根据输入问题进行规划、结合网络搜索获取信息并最终呈现结果的研究工具或技术。那这样research是如何实现的呢?最近刚好看到一个实现类似功能的开源项目: open_deep_search。本文将基于该项目进行代码层面剖析。

u011160113的博客 931

Unable to read class [XXXXXXX]} java.lang. ArrayIndexOutOfBoundsException

Java代码 @Component public class FcmHelper { private static final Logger log = LoggerFactory.getLogger(FcmHelper.class); private static String APP_ID = ""; private static String SECRET_KEY = ""; private static String CHECK_URL = ""; pr.

YPC的博客 6087

OGG工具实现MySQL同步到Oracle数据库

OGG工具实现MySQL同步数据到Oracle

Mrzhou的博客 1696

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

1.解压 tar zxvf wmsdk_bundle-xxxxxxx cd wmsdk_bundle-xxxxxxx 2. make installpkgs 3.安装gcc-arm-none-eabi http://blog.csdn.net/al86866365/article/details/47424727 4.编译测试 make boot2 5.下载 Error:

al86866365的专栏 87万+

Grok 3国内怎么用?超详细使用指南+实用指令模板

主要是用于快速分析学术论文,提取关键信息,总结研究成果。Analyze the following research paper: [粘贴或上传论文内容]1. Extract key findings, methodologies, and conclusions. (提取主要发现、方法和结论。2. Identify statistical significance and data points. (识别统计显著性和数据点。

Survivor_sl的博客 1万+

kaggle竞赛平台上数据集下载详解

从kaggle 网站上下载数据集既保证了速度又避免了网络的不稳定造成下载失败问题。该平台也可以上传代码作为自己的代码库,不过本人更习惯将代码上传到github上。希望本人整理的kaggle库使用技巧能够帮助到正在阅读本博客的你。此外还有一篇博客针对kaggle数据集下载问题的几个问题的相关文章进行了整理【博客链接】。

li1784506的博客 2万+

噩梦

给定一张N*M的地图,地图中有1个男孩,1个女孩和2个鬼。 字符“.”表示道路,字符“X”表示墙,字符“M”表示男孩的位置,字符“G”表示女孩的位置,字符“Z”表示鬼的位置。 男孩每秒可以移动3个单位距离,女孩每秒可以移动1个单位距离,男孩和女孩只能朝上下左右四个方向移动。 每个鬼占据的区域每秒可以向四周扩张2个单位距离,并且无视墙的阻挡,也就是在第k秒后所有与鬼的曼哈顿距离不超过2k的位置都会被...

sky123博客 561

AUTOSAR AP——SM模块

对AUTOSAR AP中状态管理模块SM,从模块定义、总结等多方面进行了介绍。

weixin_43627682的博客 291

[转载]Smashing The Stack For Fun And Profit

[转载]Smashing The Stack For Fun And Profit .oO Phrack 49 Oo. Volume Seven, Issue Forty-Nine ...

weixin_30916125的博客 392

安卓手机老版本微信无法登录?无需root 一招教你如何搞定!旧版本照样登录,微信7.0亲测有效

微信我试了清缓存、用不同的版本、甚至关网登录都不行。于是我研究了一下背后的原理,发现这不仅是个技巧,还是微信设计的一点“疏忽”——**只要有方法,旧版本照样能用**。

代码简单说 Vue、JAVA、PHP、Node.js 熟练运用,接口、架构、性能全搞定。 2万+

Coze实战:解锁多Bot协同与条件分支工作流的奥秘

本文详细介绍了在字节跳动Coze平台实现多Bot协同与条件分支工作流的方法。首先阐述了Coze平台的功能优势,包括丰富的插件、知识库和工作流功能。随后分步骤讲解了多Bot协同的实现:从准备工作、创建Bot到协同配置,并提供了电商客服的实例演示。在条件分支工作流部分,详细说明了条件节点的作用类型、条件设定方法以及具体配置操作,强调测试优化的重要性。最后通过电商平台综合案例,展示了多Bot协同与条件分支的实际应用效果,并针对常见问题提供解决方案。文章为开发者在Coze平台上构建智能应用提供了实用指导,有助于提升

远程部署调试 运行安装 项目调试 二次开发 项目技术新 持续迭代 部分源码免费分享 461

双向bfs——噩梦(模板)

思路:一眼丁真,鉴定为“春春的bfs”,使用两个队列分别存男孩和女孩的行动路径,注意与鬼之间的曼哈顿距离不要小于当前时间常数time乘2。

测试 321

自注意力机制(SelfAttention Mechanism)原理与代码实战案例讲解

自注意力机制(Self-Attention Mechanism)原理与代码实战案例讲解 作者:禅与计算机程序设计艺术 / Zen and the Art of Computer Programming 1. 背景介绍

AI天才研究院 1300

双向bfs --HDU - 3085 Nightmare Ⅱ

HDU - 3085 Nightmare Ⅱ:https://vjudge.net/problem/HDU-3085 题意: G和M在迷宫里寻找对方,M每秒可以走3步,G每次走一步,且只能上下左右走。迷宫里有鬼,鬼每次分裂到上下左右两格位置,直到占满所有格子,鬼可以穿墙,求G和M在不遇到鬼的情况下的最短相遇时间。 思路: 双向bfs,由于M每次走3步,所以M每次要处理3次,这要处理的点就是M每次要...

dajiangyou123456的博客 192

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

HDU3085 - Nightmare Ⅱ(双向BFS)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3085题目大意:在一个N*M的网格里,有两个人 G 和 M,并且有两只鬼。 G每秒可以走一步,G每秒可以走三步,每只鬼可以分裂,分裂到周围的的两格。假设#为鬼分裂后为1,如下图所示。每只分裂后的新鬼可以继续分裂。

ACM_Fish的博客 453

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

HDU3085 NightmareⅡ 双向BFS

题目描述 给定一张N*M的地图,地图中有1个男孩,1个女孩和2个鬼。 字符“.”表示道路,字符“X”表示墙,字符“M”表示男孩的位置,字符“G”表示女孩的位置,字符“Z”表示鬼的位置。 男孩每秒可以移动3个单位距离,女孩每秒可以移动1个单位距离,男孩和女孩只能朝上下左右四个方向移动。 每个鬼占据的区域每秒可以向四周扩张2个单位距离,并且无视墙的阻挡,也就是在第k秒后所有与鬼的曼哈顿距离不超过2k的...

正月看雪花的博客 554

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

HDU 3085 —— Nightmare Ⅱ 双向BFS

原题:http://acm.hdu.edu.cn/showproblem.php?pid=3085 题意: ' X ' 表示墙;' . ' 表示空地;' Z ' 表示鬼(鬼有两只); M每秒走三步;G每秒走一步;鬼每秒分裂,每次分裂距离鬼两步距离的地方都会被鬼覆盖,且鬼可以穿墙(当然鬼的分身也可分裂); 每秒鬼先分裂,然后M 和 G才走; 问在不遇到鬼的情况下,至少过几秒M和G可以相遇;

0x3f3f3f3f 482

HDU - 3085 Nightmare Ⅱ(双向BFS+曼哈顿距离)

HDU - 3085 Nightmare Ⅱ #include <cstring> #include <iostream> #include <algorithm> #include <queue> using namespace std; typedef pair<int, int> PII; const int N = 810; int n, m; char g[N][N]; int st[N][N]; PII ghost[2];

00后的博客 424

hdu3085 Nightmare Ⅱ 双向BFS 模板题

Nightmare ⅡTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3068    Accepted Submission(s): 874Problem DescriptionLast night, little erriyue had ...

popcjz的博客 2127

HDU 3085 Nightmare Ⅱ [双向BFS]

Nightmare Ⅱ Problem Description Last night, little erriyue had a horrible nightmare. He dreamed that he and his girl friend were trapped in a big maze separately. More terribly, there are two ghosts...

Janice_zh的博客 379

hdu 3085 Nightmare Ⅱ (双向bfs)

Nightmare Ⅱ Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 716    Accepted Submission(s): 133 Problem Description Last night, litt

To be what you what to be! 1608

HDU3085 Nightmare Ⅱ —— 双向BFS + 曼哈顿距离

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3085 Nightmare Ⅱ Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2790    Accepted Sub

A man can be destroyed, but not defeated. 1208

hdu3085Nightmare Ⅱ(双向BFS)

Nightmare Ⅱ Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4397 Accepted Submission(s): 1269 Problem Description Last night, little erriyue...

IDrandom的专栏 377

HDU - 3085 Nightmare Ⅱ 双向bfs

Last night, little erriyue had a horrible nightmare. He dreamed that he and his girl friend were trapped in a big maze separately. More terribly, there are two ghosts in the maze. They will kill the p...

zamaochick的博客 206

HDU - 3085 Nightmare Ⅱ(双向bfs)

题目链接:点击查看 题目大意:给出一个迷宫,一个男孩和一个女孩还有两只鬼,男孩每秒钟走3格,女孩每秒钟走1格,鬼每秒钟向四周分裂2格,问男孩和女孩能否在鬼占领迷宫之前汇合,能的话输出汇合时间,否则输出-1 题目分析:双向bfs模板题,不过在我看来双向bfs和单向bfs没什么区别,就是格式上有点不一样,对于这个题目每次男孩bfs一次,然后女孩bfs一次,注意实时判断当前格子是否已经被鬼占领,每次...

Falcon的博客 551
上一篇: HDU1180 诡异的楼梯[bfs]
下一篇: POJ2488 A Knight's Journey[dfs]
ControlBear
博客等级 码龄11年 34粉丝 51原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址