FZU - 2150 Fire Game bfs+双起点枚举】的更多相关文章

题意,10*10的地图,有若干块草地“#”,草地可以点燃,并在一秒后点燃相邻的草地.有墙壁‘·‘阻挡.初始可以从任意两点点火.问烧完最短的时间.若烧不完输出-1. 题解:由于100的数据量,直接暴力.枚举两个起点,推入队列,然后bfs.烧完就返回深度,更新一个min值. 坑:(帮同学照bug) return t.step+1;bfs后没有算上最后一步 ac代码 #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <cs…
题目链接:http://acm.fzu.edu.cn/problem.php?pid=2150 Problem Description Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or just empty a…
Problem Description Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or just empty and then they start to fire all the grass. Firstl…
FZU 2150 Fire Game(点火游戏) Time Limit: 1000 mSec    Memory Limit : 32768 KB Problem Description - 题目描述 Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is co…
称号:fzupid=2150"> 2150 Fire Game :给出一个m*n的图,'#'表示草坪,' . '表示空地,然后能够选择在随意的两个草坪格子点火.火每 1 s会向周围四个格子扩散,问选择那两个点使得燃烧全部的草坪花费时间最小? 分析:这个题目假设考虑技巧的话有点难度,可是鉴于数据范围比較小,我们能够暴力枚举随意的草坪所在的点,然后两个点压进队列里面BFS.去一个满足条件的最小值就可以. 顺便说一下 fzu 2141 Sub-Bipartite Graph 的思路,比赛的时候没…
[题目链接]click here~~ [题目大意]: 两个熊孩子要把一个正方形上的草都给烧掉,他俩同一时候放火烧.烧第一块的时候是不花时间的.每一块着火的都能够在下一秒烧向上下左右四块#代表草地,.代表着不能烧的.问你最少花多少时间能够烧掉.假设烧不掉就输出-1 [解题思路]: 数据比較弱的情况下直接暴力枚举每块草坪上能够放的位置,比較高端的写法眼下没有想到.以后想到了文章更新下~~ ps:因为一个细节没注意,导致WA了差点儿一页,还以为FZU 判题出错了.后来突然发现每次从队列里拿出队首的元素…
Problem 2150 Fire Game Accept: 2133    Submit: 7494Time Limit: 1000 mSec    Memory Limit : 32768 KB Problem Description Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid…
Fire Game Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice FZU 2150 Description Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning,…
Problem Description Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or just empty and then they start to fire all the grass. Firstl…
<题目链接> 题目大意: 两个熊孩子在n*m的平地上放火玩,#表示草,两个熊孩子分别选一个#格子点火,火可以向上向下向左向右在有草的格子蔓延,点火的地方时间为0,蔓延至下一格的时间依次加一.求烧完所有的草需要的最少时间.如不能烧完输出-1. 解题分析: 暴力枚举两个起点,然后用BFS求出这两个火源能够蔓延到最远的草地所花的时间,在那些能够烧完所有草地的情况中,选择用时最少的. #include <iostream> #include <cstring> #include…