Constructing Roads There are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can connect to e ...
分类:
其他好文 时间:
2018-11-13 02:29:40
阅读次数:
193
P2872 [USACO07DEC]道路建设Building Roads kruskal求最小生成树。 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<cmath> 5 #include<queue> 6 ...
分类:
其他好文 时间:
2018-10-27 18:42:20
阅读次数:
214
P2907 [USACO08OPEN]农场周围的道路Roads Around The Farm 基础dfs,按题意递归即可。 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #define re register 5 usi ...
分类:
其他好文 时间:
2018-10-27 17:10:45
阅读次数:
210
题目链接:http://poj.org/problem?id=2631 求树的直径模板。 定理: 树上任意一个点的在树上的最长路一定以树的直径的两端点其中一点结束。 做法: 两边bfs,第一次先找到node(树的直径的两端点其中一个),再一次求node的最长路所结束的点t node— t就是树的直径 ...
分类:
其他好文 时间:
2018-10-12 17:03:53
阅读次数:
130
Description Barney lives in country USC (United States of Charzeh). USC has n cities numbered from 1 through n and n?-?1 roads between them. Cities an ...
分类:
其他好文 时间:
2018-10-08 11:28:07
阅读次数:
396
题目链接:http://poj.org/problem?id=1251 题意:n个村庄字母标号,每个字母后跟m个字母,表示该字母到mi的距离。求构建所有村庄道路的最短距离。 题解:最小生成树裸题。注意输入。 代码: ...
分类:
其他好文 时间:
2018-10-07 00:40:05
阅读次数:
142
【网络流】One Way Roads 题目描述 In the country of Via, the cities are connected by roads that can be used in both directions. However, this has been the cause ...
分类:
其他好文 时间:
2018-10-07 00:39:27
阅读次数:
172
http://poj.org/problem?id=2421 There are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can ...
分类:
其他好文 时间:
2018-10-05 18:45:15
阅读次数:
133
http://poj.org/problem?id=1251 The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads ...
分类:
其他好文 时间:
2018-10-05 12:16:56
阅读次数:
150
就是在最短路的基础上 多加了一个时间的限制 , 多一个限制多一维就好了 记住 分层最短路要用dijistra !!! ...
分类:
其他好文 时间:
2018-10-04 10:38:18
阅读次数:
158