题目:这里 题意: 感觉并不能表达清楚题意,所以 Problem Description In mathematics, and more specifically in graph theory, a tree is an undirected graph in which any two nod ...
分类:
其他好文 时间:
2016-09-14 20:29:22
阅读次数:
118
Sparse Graph Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1520 Accepted Submission(s): 537 P ...
分类:
其他好文 时间:
2016-09-14 20:26:43
阅读次数:
122
题意:给你n个点m条边形成一个无向图,问你求出给定点在此图的补图上到每个点距离的最小值,每条边距离为1 补图:完全图减去原图 完全图:每两个点都相连的图 其实就是一个有技巧的bfs,我们可以看到虽然点很多但边很少,就使用vector存下每个点在原图中可以到达其他的哪些点,再使用bfs寻找此时起点可以 ...
分类:
其他好文 时间:
2016-09-13 23:53:03
阅读次数:
205
题目链接:hdu5876 Sparse Graph 一开始用vector一直TLE,然后就没有然后了。。 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 #include<queue> 5 #include<vector> ...
分类:
其他好文 时间:
2016-09-13 22:06:14
阅读次数:
184
Sparse Graph Problem Description In graph theory, the complement of a graph G is a graph H on the same vertices such that two distinct vertices of H a ...
分类:
其他好文 时间:
2016-09-13 22:03:23
阅读次数:
213
题目:这里 题意: 相当于一开始给一个初始好了的无向完全图给你,然后给让你删除m条边,再给你一个点v,最后问你在剩下的图里从这个点v出发能到达所有边点的最小路径是多少? 一看是所有点的最小路径,一看就觉得是个bfs,记忆化搜一下然后加个优化什么的,由于数据不知道是个什么奇葩而且比赛中还改数据,所以很 ...
分类:
其他好文 时间:
2016-09-12 14:16:49
阅读次数:
178
http://acm.hdu.edu.cn/showproblem.php?pid=5876 Sparse Graph Problem Description In graph theory, the complement of a graph G is a graph H on the same ...
分类:
其他好文 时间:
2016-09-12 09:50:43
阅读次数:
235
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5876 题意:求一个图的补图中的单源最短路。 题解说:补图上的 BFS 是非常经典的问题。一般的做法是用链表(或者偷懒用 std::set)维护还没 BFS 过的点。当要扩展点 u 的时候,遍历一次还没访 ...
分类:
其他好文 时间:
2016-09-11 23:00:13
阅读次数:
263
Sparse Graph Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Problem Description In graph theory, the complement of ...
分类:
其他好文 时间:
2016-09-11 00:05:45
阅读次数:
270
题目:Sparse Graph 链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=5876 题意:给出一个图(V<=20万,E<=2万),要求先化为补图(每两个点,原本有边删去边,原本没边添加边),然后问指定点S到其他每个点的最短距离。 思路: 普 ...
分类:
其他好文 时间:
2016-09-11 00:05:02
阅读次数:
197