UESTC 1811 Hero Saving Princess】的更多相关文章

九野的博客,转载请注明出处 http://blog.csdn.net/acmmmm/article/details/11104265 题目链接 :http://222.197.181.5/problem.php?pid=1811 题意:T个测试数据 n m //n个点 m条边 m条无向边 que//下面有que个数据 a b // 表示a点的钥匙在b中 问,从0点开始能否遍历所有的点 思路:用BFS搜一遍即可,注意图是否连通,用并查集判断一下 BFS()时,q为正常队列,p为走到那个点是锁住时将…
Saving Princess claire_ Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 4308 Description Princess claire_ was jailed in a maze by Grand Demon Monster(GDM) teoy. Out of anger, little Prince ykwd…
Saving Princess claire_ Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2354    Accepted Submission(s): 843 Problem Description Princess claire_ was jailed in a maze by Grand Demon Monster(GDM)…
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4308 Saving Princess claire_ Description Princess claire_ was jailed in a maze by Grand Demon Monster(GDM) teoy.Out of anger, little Prince ykwd decides to break into the maze to rescue his lovely Prince…
原题直通车:HDU 4308 Saving Princess claire_ 分析: 两次BFS分别找出‘Y’.‘C’到达最近的‘P’的最小消耗.再算出‘Y’到‘C’的最小消耗,比较出最小值 代码: #include<iostream> #include<cstdio> #include<cstring> #include<queue> #include<string> using namespace std; const int inf=0xF…
http://acm.hdu.edu.cn/showproblem.php?pid=4308 Saving Princess claire_ Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2305    Accepted Submission(s): 822 Problem Description Princess claire_ wa…
Saving Princess Time Limit: 1000ms Memory Limit: 32768KB This problem will be judged on ZJU. Original ID: 336964-bit integer IO format: %lld      Java class name: Main Special Judge   Saving princesses is always a hard work. Ivan D'Ourack is planning…
为了准备算法考试刷的,想明确一点即可,全部的传送门相当于一个点,当遇到一个传送门的时候,把全部的传送门都压入队列进行搜索 贴代码: #include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <queue> using namespace std; const int MAXN = 5000+50; int r,c,f,si,sj,e…
求出不使用P点时起点到终点的最短距离,求出起点到所有P点的最短距离,求出终点到所有P点的最短距离. 答案=min( 不使用P点时起点到终点的最短距离, 起点到P的最短距离+终点到P的最短距离 ) #include <cstdio> #include <cstring> #include <cstdlib> #include <algorithm> #include <queue> using namespace std; ; << ;…
题目传送门 题意:一个(r*c<=5000)的迷宫,起点'Y‘,终点'C',陷阱‘#’,可行路‘*’(每走一个,*cost),传送门P,问Y到C的最短路 分析:一道最短路问题,加了传送门的功能,那么第一次走到P时是最短的路径,之后再到P都不会比第一次短,所以将所有P看成一个点,走过就vis掉,剩下就是简单的BFS了 收获:1.复习BFS求最短路 2. memset不能乱用,尤其是数组很大时,容易爆内存 代码: /******************************************…