hdu 3681 Prison Break】的更多相关文章

Problem Description Rompire is a robot kingdom and a lot of robots live there peacefully. But one day, the king of Rompire was captured by human beings. His thinking circuit was changed by human and thus became a tyrant. All those who are against him…
Prison Break Time Limit: 5000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3214    Accepted Submission(s): 829 Problem Description Rompire is a robot kingdom and a lot of robots live there peacefully. But on…
Problem Description Rompire . Now it’s time to escape, but Micheal# needs an optimal plan and he contacts you, one of his human friends, for help. The jail area is a rectangle contains n×m little grids, each grid might be one of the following: ) Empt…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3681 前些天花时间看到的题目,但写出不来,弱弱的放弃了.没想到现在学弟居然写出这种代码来,大吃一惊附加敬仰之情.这里借用下他的成果,好好学习吧,骚年*** Sample Input 5 5 GDDSS SSSFS SYGYS SGSYS SSYSS 0 0   Sample Output 4 题意:给出矩阵(作为监狱)和在监狱中的一个装有电池的机器人,其中 F为出发点,图中只有一个,且初始状态下机器…
http://acm.hdu.edu.cn/showproblem.php?pid=3681 题意:一个n*m的矩阵,'F'是起点.机器人从F出发,走到G可以充电,走到Y关掉开关,D不能走进,要求把所有开关关掉,且电量最少,并求出该最小电量. 把F,G,Y的坐标存起来,然后用bfs求出它们每两个点最短距离,然后用dp判断是不是可以满足目的状态. 用二分枚举答案. #include <cstdio> #include <queue> #include <cstring>…
题意:给定上一个 n * m的矩阵,你的出发点是 F,你初始有一个电量,每走一步就会少1,如果遇到G,那么就会加满,每个G只能第一次使用,问你把所有的Y都经过,初始电量最少是多少. 析:首先先预处理每个F,G,Y的最短距离,用 bfs 可以实现,然后再二分电量,进行判断,在进行判断时,dp[s][i] 表示已经走点的状态是s,当前在 i,然后如果能走过所有的就就是true,否则是false. 代码如下: #pragma comment(linker, "/STACK:1024000000,102…
题意: 给一个n*m的矩阵,每个格子中有一个大写字母,一个机器人从‘F’出发,拾取所有的开关‘Y’时便能够越狱,但是每走一格需要花费1点能量,部分格子为充电站‘G’,每个电站只能充1次电.而且部分格子为障碍'D'或者空格‘S’.机器人在开始时电池是满能量的,问电池容量至少为多少可以越狱?(1<=n,m<=14,充电站+开关的总个数<=15) 思路: 看错题了,以为充电站和开关的个数分别至多为14,其实是两种加起来14. 既然只有15个关键的格子,那么状压就有用了.假设每个点关键格必须走1…
题意:一张图,F是起点,Y是必须要到的点,D不能走,G可以充电.可以往四个方向走,每走一步花费一个电,走到G可以选择充满电或者不充,每个G只能充一次.问你走遍Y的最小初始点亮.number(G) + number(Y) <= 15 思路:显然Y和G都只要用一次就行,那么状压YG状态.然后BFS出任意YG两点最短路,状压DP.用&判断最终结果是不是当前状态的子集. 代码: #include<set> #include<map> #include<cmath>…
地址:http://acm.split.hdu.edu.cn/showproblem.php?pid=3511 题目: Prison Break Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2149    Accepted Submission(s): 681 Problem Description To save Sara, Mi…
Time Limit: 5000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4867    Accepted Submission(s): 1329 Problem Description Rompire is a robot kingdom and a lot of robots live there peacefully. But one day, the ki…