poj 1475 uva 589 - Pushing Boxes】的更多相关文章

题目大意 人推箱子从起点到终点,要求推箱子的次数最少,并打印出来人移动的路径. 题目分析 对于箱子进行宽搜的同时,要兼顾人是否能够把箱子推到相应的位置 每一次对箱子bfs 然后对人再bfs #include<cstdio>#include<cstring>#include<queue>#include<cmath>#include<iostream>#include<algorithm>#include<string>us…
http://poj.org/problem?id=1475 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=249 Pushing Boxes Time Limit: 2000MS   Memory Limit: 131072K Total Submissions: 4662   Accepted: 1608   Special Judge Description Imagine you are standing insid…
[poj P1475] Pushing Boxes Time Limit: 2000MS   Memory Limit: 131072K   Special Judge Description Imagine you are standing inside a two-dimensional maze composed of square cells which may or may not be filled with rock. You can move north, south, east…
Pushing Boxes Time Limit: 2000ms Memory Limit: 131072KB This problem will be judged on PKU. Original ID: 147564-bit integer IO format: %lld      Java class name: Main Special Judge   Imagine you are standing inside a two-dimensional maze composed of…
题目传送门 首先说明我这个代码和lyd的有点不同:可能更加复杂 既然要求以箱子步数为第一关键字,人的步数为第二关键字,那么我们可以想先找到箱子的最短路径.但单单找到箱子的最短路肯定不行啊,因为有时候不能被推动,怎样确定一条既满足最短又满足可行的箱子路径呢,其实这就是一种有限制的BFS. 对于箱子: 设现在的位置为x,y,扩展方向为dx,dy,将要到达的下一个位置为x+dx,y+dy check它是否可行: 1.不越界. 2.之前没有走过. 3.不能走到“#”上. 4.人能够从当前站立的位置到达(…
UVa 103 题目大意:给定n个箱子,每个箱子有m个维度, 一个箱子可以嵌套在另一个箱子中当且仅当该箱子的所有的维度大小全部小于另一个箱子的相应维度, (注意箱子可以旋转,即箱子维度可以互换),求最多能套几个箱子. 第一行输入为n,m,之后是n行m维的箱子 解题思路:嵌套关系是二元关系,因此这题即在DAG上做动态规划, 只不过将二维的判断改成了n维,其他不变. 详细看考:DAG上的动态规划之嵌套矩形  (ps:这题可以理解成嵌套m边形) /* UVa 103 Stacking Boxes --…
Pushing Boxes Description Imagine you are standing inside a two-dimensional maze composed of square cells which may or may not be filled with rock. You can move north, south, east or west one cell at a step. These moves are called walks. One of the e…
POJ1475 Pushing Boxes  推箱子,#表示墙,B表示箱子的起点,T表示箱子的目标位置,S表示人的起点 本题没有 Special Judge,多解时,先最小化箱子被推动的次数,再最小化人移动的步数.若仍有多条路线,则按照N.S.W.E的顺序优先选择箱子的移动方向(即先上下推,再左右推).在此前提下,再按照n.s.w.e的顺序优先选择人的移动方向(即先上下动,再左右动). 每个阶段的状态包括人的位置,箱子的位置,由于每次在移动箱子之后,认得位置一定位于箱子之前的位置,所以可以将每次…
Description The main land of Japan called Honshu is an island surrounded by the sea. In such an island, it is natural to ask a question: “Where is the most distant point from the sea?” The answer to this question for Honshu was found in 1996. The mos…
题目地址: http://poj.org/problem?id=1475 两重BFS就行了,第一重是搜索箱子,第二重搜索人能不能到达推箱子的地方. AC代码: #include <iostream> #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <string> #include <vector> #inc…