hdu3681--Prison Break(TSP+二分)】的更多相关文章

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…
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…
Prison Break 时间限制: 1 Sec  内存限制: 128 MB提交: 105  解决: 16[提交][状态][讨论版] 题目描述 Scofild又要策划一次越狱行动,和上次一样,他已经掌握了整个监狱的地图,看守的位置,以及准备好了逃出监狱的出口.由于消息被其他监狱中的囚犯得知了,为了不泄露消息,他不得不将所有人带出监狱. 这是一个月黑风高的夜晚...看守们都已经睡着,在没有罪犯打扰的情况下绝对不会醒来,即罪犯不能到达看守所在位置.在每一个空地中,都有一名罪犯,并且同一个空地,能容纳…
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.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…
1254 - Prison Break   PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB Michael Scofield has just broken out of the prison. Now he wants to go to a certain city for his next unfinished job. As you are the only programmer on h…
题意:给定上一个 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(n,m<=15)的字符数组代表监狱,F代表起始点,G代表补充满电量,每个G只能补充一次,Y代表开关,D不能经过,S表示空地.要求打开所有开关,也就是经过所有Y点,电池的满电量最少是多少.如果不能逃出输出-1.G和Y的个数和不会超过15. 题解:二分答案.通过bfs预处理出G,Y,F两两之间的距离,然后转化成TSP求解.借鉴了别人的代码. #include <bits/stdc++.h> #d…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3681 前些天花时间看到的题目,但写出不来,弱弱的放弃了.没想到现在学弟居然写出这种代码来,大吃一惊附加敬仰之情.这里借用下他的成果,好好学习吧,骚年*** Sample Input 5 5 GDDSS SSSFS SYGYS SGSYS SSYSS 0 0   Sample Output 4 题意:给出矩阵(作为监狱)和在监狱中的一个装有电池的机器人,其中 F为出发点,图中只有一个,且初始状态下机器…