题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=20846 POJ 3026是同样的题,但是内存要求比较严格,并是没有过... 对以迷宫形式给定的一些点求最小生成树,不过这里的边并不是抽象的两点间笛卡尔距离,也不是折线距离(迷宫中有障碍),而是需要用四个方向的搜索来求. 用bfs求出任两点间的最短距离后,可用kruscal求出最小生成树. 这次值得一提的是对并查集的一点改造:由于每个顶点由一组(x,y)坐标唯一确定…
点击打开链接 Borg Maze Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7097   Accepted: 2389 Description The Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used t…
Borg Maze Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8905   Accepted: 2969 Description The Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to descr…
Borg Maze Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 18644   Accepted: 5990 题目链接:http://poj.org/problem?id=3026 Description: The Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Bor…
题目链接:http://poj.org/problem?id=3026. Description The Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to describe the group consciousness of the Borg civilization. Ea…
有几个错误,调试了几个小时,样例过后 1Y. 题目:http://poj.org/problem?id=3026 题意:就是让求A们和S的最小生成树 先用bfs找每两点的距离,再建树.没剪枝 63MS. #include <iostream> #include<cstdio> #include<cstring> #include<cstdlib> #include<stack> #include<queue> #include<…
题目链接. 题目大意: 任意两点(点表示字母)可以连线,求使所有点连通,且权值和最小. 分析: 第一感觉使3维的BFS.但写着写着,发现不对. 应当用最小生成树解法.把每个字母(即A,或S)看成一个结点,如果求出来任意两个结点间的权值,则求解即为求最小生成树. 通过暴力,对每一个字母进行BFS,求出任意两个结点的距离.然后prim. AC代码如下: #include <iostream> #include <cstdio> #include <cstdlib> #inc…
题意:从S出发,去抓每一个A,求总路径最短长度.在S点和A点人可以分身成2人,不过一次只能让一个人走. 思路是先利用BFS求出各点之间的距离,建成图,再套用最小生成树模板. 一次性A了.不过觉得在判断第几个编号的点时稍显麻烦了. #include <iostream> #include <cstdio> #include <cstring> #include <queue> using namespace std; const int inf=1000000…
题意: 求把S和所有的A连贯起来所用的线的最短长度... 这道题..不看discuss我能wa一辈子... 输入有坑... 然后,,,也没什么了...还有注意 一次bfs是可以求当前点到所有点最短距离的... #include <iostream> #include <cstdio> #include <cstring> #include <queue> #include <algorithm> #include <cmath> #d…
Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9821   Accepted: 3283 Description The Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to describe the gr…
( ̄▽ ̄)" #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<vector> #include<queue> using namespace std; const int INF=10e8; ; int col,row,k,minn; char str[MAXN][MAXN]; ][MAXN*],lowdis…
题目链接:http://poj.org/problem?id=3026 题目大意:在一个y行 x列的迷宫中,有可行走的通路空格’  ‘,不可行走的墙’#’,还有两种英文字母A和S,现在从S出发,要求用最短的路径L连接所有字母,输出这条路径L的总长度. 解题思路:相当于所有的字母A和S都是结点,求连接这些结点的最小距离和,是最小生成树的题目.先用BFS求各点间的距离,然后再用Prim(Kruskal也可以)求出最小距离就可以了. 注意:输完行列m和n之后,后面有一堆空格,要用gets()去掉,题目…
J - Borg Maze 思路:bfs+最小生成树. #include<queue> #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #define MAXN 110 using namespace std; int fa[MAXN]; struct nond{ int x,y,z; }v[MAXN*MAXN]; struct none{ int…
Borg Maze 题目链接: http://acm.hust.edu.cn/vjudge/contest/124434#problem/I Description The Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to describe the group consciou…
Borg Maze Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6634   Accepted: 2240 Description The Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to descr…
Borg Maze Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 16625   Accepted: 5383 Description The Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to desc…
链接: http://poj.org/problem?id=3026 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=22010#problem/J Borg Maze Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6905   Accepted: 2315 Description The Borg is an immensely powerful race o…
Borg Maze DescriptionThe Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to describe the group consciousness of the Borg civilization. Each Borg individual is linked…
Borg Maze 题意: 题目我一开始一直读不懂.有一个会分身的人,要在一个地图中踩到所有的A,这个人可以在出发地或者A点任意分身,问最少要走几步,这个人可以踩遍地图中所有的A点. 思路: 感觉就算读懂了题目,也比较难想到这用到了最小生成树的知识,因为可以分身,所以每个点可以向其他点都连上边.可以用bfs预处理出所有的S点,A点的连线,再跑一遍最小生成树,即可得出答案.这里有几点注意,一开始我bfs没有记录step,而是直接找到一点后算曼哈顿距离,这是不对的,因为可能是绕了一个圈到了这个点.还…
http://poj.org/problem?id=3026 Borg Maze Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Practice POJ 3026 Description The Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of…
Borg Maze Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7998   Accepted: 2675 Description The Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to descr…
Borg Maze Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 14165   Accepted: 4619 Description The Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to desc…
Borg Maze Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9220   Accepted: 3087 Description The Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to descr…
http://poj.org/problem?id=3026 Borg Maze Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 12086   Accepted: 3953 Description The Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg coll…
Borg Maze http://poj.org/problem?id=3026 Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 18230   Accepted: 5870 Description The Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg coll…
Borg Maze Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 12729   Accepted: 4153 Description The Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to desc…
id=3026">[POJ 3026]Borg Maze 一个考察队搜索alien 这个考察队能够无限切割 问搜索到全部alien所须要的总步数 即求一个无向图 包括全部的点而且总权值最小(最小生成树 BFS+最小生成树 Prim/Kruskal-懒死了 就这么贴吧--凑活看( ̄┰ ̄*) #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #i…
UVA 12206 - Stammering Aliens 题目链接 题意:给定一个序列,求出出现次数大于m,长度最长的子串的最大下标 思路:后缀数组.搞出height数组后,利用二分去查找就可以 这题之前还写过hash的写法也能过,只是写后缀数组的时候,犯了一个傻逼错误,把none输出成node还一直找不到...这是刷题来第二次碰到这样的逗比错误了,还是得注意. . 代码: #include <cstdio> #include <cstring> #include <alg…
Description 老 Jack 有一片农田,以往几年都是靠天吃饭的.但是今年老天格外的不开眼,大旱.所以老 Jack 决定用管道将他的所有相邻的农田全部都串联起来,这样他就可以从远处引水过来进行灌溉了.当老 Jack 买完所有铺设在每块农田内部的管道的时候,老 Jack 遇到了新的难题,因为每一块农田的地势高度都不同,所以要想将两块农田的管道链接,老 Jack 就需要额外再购进跟这两块农田高度差相等长度的管道. 现在给出老 Jack农田的数据,你需要告诉老 Jack 在保证所有农田全部可连…
Description The Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to describe the group consciousness of the Borg civilization. Each Borg individual is linked to the c…