BZOJ 1656: [Usaco2006 Jan] The Grove 树木(神奇的bfs之射线法)

1656: [Usaco2006 Jan] The Grove 树木 Time Limit: 5 Sec Memory Limit: 64 MB Submit: 143 Solved: 88 [Submit][Status][Discuss] Description The pasture contains a small, contiguous grove of trees that has no ‘holes’ in the middle of the it. Bessie wonders: how far is it to walk around that grove and get back to my starting position? She's just sure there is a way to do it by going

BZOJ 1646: [Usaco2007 Open]Catch That Cow 抓住那只牛 (BFS)

1646: [Usaco2007 Open]Catch That Cow 抓住那只牛 Time Limit: 5 Sec Memory Limit: 64 MB Submit: 915 Solved: 441 [Submit][Status][Discuss] Description Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 <= N <= 100,000) on a number line and the cow is at a point K (0 <= K <= 100,000)

BZOJ 1644: [Usaco2007 Oct]Obstacle Course 障碍训练课 (BFS,DP)

1644: [Usaco2007 Oct]Obstacle Course 障碍训练课 Time Limit: 5 Sec Memory Limit: 64 MB Submit: 451 Solved: 226 [Submit][Status][Discuss] Description 考虑一个 N x N (1 <= N <= 100)的有1个个方格组成的正方形牧场。有些方格是奶牛们不能踏上的,它们

BZOJ 1632: [Usaco2007 Feb]Lilypad Pond (BFS,dp)

1632: [Usaco2007 Feb]Lilypad Pond Time Limit: 5 Sec Memory Limit: 64 MB Submit: 496 Solved: 153 [Submit][Status][Discuss] Description Farmer John 建造了一个美丽的池塘,用于让他的牛们审美和锻炼。这个长方形的池子被分割成了 M 行和 N 列( 1 ≤ M ≤ 30 ; 1

BZOJ 1627: [Usaco2007 Dec]穿越泥地 (BFS)

1627: [Usaco2007 Dec]穿越泥地 Time Limit: 5 Sec Memory Limit: 64 MB Submit: 624 Solved: 411 [Submit][Status][Discuss] Description 清早6:00,Farmer John就离开了他的屋子,开始了他的例行工作:为贝茜挤奶。前一天晚

BZOJ1619: [Usaco2008 Nov]Guarding the Farm 保卫牧场 (BFS)

1619: [Usaco2008 Nov]Guarding the Farm 保卫牧场 Time Limit: 5 Sec Memory Limit: 64 MB Submit: 661 Solved: 292 [Submit][Status][Discuss] Description The farm has many hills upon which Farmer John would like to place guards to ensure the safety of his valuable milk-cows. He wonders how many guards he will need if he wishes to put one on top of each hill. He has a map supplied as

BZOJ 1611: [Usaco2008 Feb]Meteor Shower流星雨 (BFS)

1611: [Usaco2008 Feb]Meteor Shower流星雨 Time Limit: 5 Sec Memory Limit: 64 MB Submit: 1239 Solved: 537 [Submit][Status][Discuss] Description 去年偶们湖南遭受N年不遇到冰冻灾害,现在芙蓉哥哥则听说另一个骇人听闻的消息: 一场流星雨即

bzoj 1602: [Usaco2008 Oct]牧场行走 (bfs,优先队列)

Description N头牛(2<=n<=1000)别人被标记为1到n,在同样被标记1到n的n块土地上吃草,第i头牛在第i块牧场吃草。 这n块土地被n

bc #77 ||hdu 5652 India and China Origins (图的动态连通性问题,并查集or 二分+bfs验证连通性)

题目链接 题意:没图不好描述,有中文题面中文题面,直接看吧。 思路:据说这道题有三种做法。 当时比赛一种都不会。 先说一种:做法是把格子看成点,可以

codeforces 520 B. Two Buttons (bfs)

做过一道类似的题 因为是问最短,很容易想到是bfs 对于点x,可以到达点x-1,和点2*x 需要注意的是上界限。 并不是max(m,n) 因为可能先达

poj 2688 Cleaning Robot (tsp问题)

______ 好蠢,竟然没看出来这道题的不同之处,以为就是个搜 然后样例什么的都过了... 结果显然wa… 然后才发现,这道题应该是t

I - Fire Game (两个点开始的bfs)

http://acm.hust.edu.cn/vjudge/contest/view.action?cid=83084#problem/I I - Fire Game **Time Limit:**1000MS **Memory Limit:**32768KB 64bit IO Format:%I64d & %I64u Submit Status 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. Firstly they choose two grids which are consisting of

poj 3414 pots (bfs+路径记录)

Pots Description You are given two pots, having the volume of A and B liters respectively. The following operations can be performed: FILL(i) fill the pot i (1 ≤ **i **≤ 2) from the tap; DROP(i) empty the pot i to the drain; POUR(i,j) pour from pot i to pot j; after this operation either the pot j is full (and there may be some water left in

hdoj 1495 非常可乐(bfs)

非常可乐 **Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 7194 Accepted Submission(s): 2865 ** Problem Description 大家一定觉的运动以后喝可乐是一件很惬意的事情,但是seeyou却不这么认为。因为每次当seey

hdoj 2612 find a way (两次bfs)

Find a way ****Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 6221 Accepted Submission(s): 2070 ** ** Problem Description Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally. Leave Ningbo one year, yifenfei have many people to meet. Especially a good friend Merceki. Yifenfei's home is at the countryside, but Merceki's home is in the center of city. So yifenfei made arrangements with

poj 3984 迷宫问题

迷宫问题 Description 定义一个二维数组: <br></br>int maze[5][5] = { <br></br> 0, 1, 0, 0, 0, <br></br> 0, 1, 0, 1, 0, <br></br> 0, 0, 0, 0, 0, <br></br> 0, 1, 1, 1, 0, <br></br> 0, 0, 0, 1, 0, <br></br>}; 它表示一个迷宫,其中的1表示墙壁,0表示可

poj 3087 Shuffle'm Up (bfs)

http://poj.org/problem?id=3087 用bfs写的,但是其实就是个模拟啊喂! 只有一种操作,何谈最短? 一直往下写就行了. 有一点疑惑,就是map的初始值 比如我定义的 map<s

poj 3126 Prime Path (bfs)

http://poj.org/problem?id=3126 题意是说,给定两个四位素数a b 问从a变换到b,最少需要变换几次. 变换的要求是,每次只能改变一个数字,而且中间过程得到的四位数也必须为素数.

poj 2251 Dungeon Master (三维bfs)

http://poj.org/problem?id=2251 简单bfs,只不过是三维的。。。 唯一的坑点在输出上… Escaped in %d minute(s) 这意思是答案为1输出minute,不为1输出minutes还是说

poj 3278 catch that cow

http://poj.org/problem?id=3278 bfs,用到了stl的queue /* *********************************************** Author :111qqz Created Time :2016年02月19日 星期五 15时45分05秒 File Name :3278.cpp ************************************************ */ #include <algorithm> #include <cstdio> #include <iostream> #include <cstring> #include <string> #include <cmath> #include <map> #include <stack> #include <queue>