码迷,mamicode.com
首页 >  
搜索关键字:jungle roads    ( 729个结果
hdu 1301 Jungle Roads
最小生成树裸题,懒得写,直接模板 #include #include #include #include #define inf 1<<30 #define maxn 30 using namespace std; int n; vectormapp[maxn]; int vaule[maxn][maxn]; int visit[maxn]; void prim() { int d[max...
分类:其他好文   时间:2015-08-26 01:51:32    阅读次数:161
codeforces Gym 100338C Important Roads
正反两次最短路用于判断边是不是最短路上的边,把最短路径上的边取出来。然后求割边。#includeusing namespace std;typedef long long ll;#define fi first#define se second#define bug(x) coutdfn[u]) {...
分类:其他好文   时间:2015-08-21 18:58:29    阅读次数:137
hdu 1102 Constructing Roads(kruskal || prim)
求最小生成树,有一点点的变化,就是有的边已经给出来了,所以,最小生成树里面必须有这些边,kruskal和prim算法都可以,prim更简单一些,有一点需要注意,用克鲁斯卡尔算法的时候需要将已经存在的边预处理一下,并查集转化为同一个祖先,记得要找他们的祖先再转化。普里姆算法只需要将那些已经存在的边都初始化为0就可以了。 kruskal: #include #include #include #i...
分类:其他好文   时间:2015-08-19 20:45:04    阅读次数:95
UvA 12661 Funny Car Racing (最短路)
There is a funny car racing in a city with n junctions and m directed roads.The funny part is: each road is open and closed periodically. Each road is...
分类:其他好文   时间:2015-08-18 19:03:28    阅读次数:174
POJ 1251 Jungle Roads (最小生成树)
POJ 1251 Jungle RoadsDescription The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between villages some years ago. But the jung...
分类:其他好文   时间:2015-08-17 21:54:22    阅读次数:107
POJ 2631 -- Roads in the North【树的直径 && 裸题】
Roads in the North Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 2358   Accepted: 1156 Description Building and maintaining roads among communities in th...
分类:其他好文   时间:2015-08-17 19:39:57    阅读次数:97
(最小生成树)Constructing Roads -- poj -- 2421
链接:http://poj.org/problem?id=2421代码:#include #include #include #include using namespace std;const int N = 110;const int INF = 0xfffffff;int n, J[N][N]...
分类:其他好文   时间:2015-08-16 22:57:16    阅读次数:131
(最小生成树) Jungle Roads -- POJ -- 1251
链接:http://poj.org/problem?id=1251代码:#include #include #include #include using namespace std;const int N = 110;const int INF = 0xfffffff;int n, J[N][N]...
分类:其他好文   时间:2015-08-16 22:49:15    阅读次数:140
How Many Roads?
1005: 【2012四川省热身赛】Problem B. How Many Roads?Time Limit: 1 SecMemory Limit: 32 MBDescriptionAs a director of cities transportation construction, Elfnes...
分类:其他好文   时间:2015-08-16 21:10:11    阅读次数:264
HDU 1025-Constructing Roads In JGShining's Kingdom(最长不降子序列,线段树优化)
分析:最长不降子序列,n很大o(n^2)肯定超,想到了小明序列那个题用线段树维护前面的最大值即可该题也可用二分搜索来做。注意问题输出时的坑,路复数后加s#include #include #include #include #include #include #include #include #i...
分类:其他好文   时间:2015-08-16 18:17:37    阅读次数:88
729条   上一页 1 ... 43 44 45 46 47 ... 73 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!