![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
图算法
hhy518518
这个作者很懒,什么都没留下…
展开
-
POJ1659Havel-Hakimi定理判断图的可图性
//度序列//1,Havel-Hakimi定理主要用来判定一个给定的序列是否是可图的。//// 2,首先介绍一下度序列:若把图 G 所有顶点的度数排成一个序列 S,则称 S 为图 G 的度序列。//// 3,一个非负整数组成的有限序列如果是某个无向图的序列,则称该序列是可图的。//// 4,判定过程:(1)对当前数列排序,使其呈递减,(2)从S【2】开始对其后S【1】个数字-1,(3原创 2015-07-09 22:20:04 · 433 阅读 · 0 评论 -
HDOJ1272并查集加判断森林
#pragma comment(linker, "/STACK:1024000000,1024000000")#include using namespace std;#define MAX_N 100005static int par[MAX_N];static void init(){ for(int i=0;i<MAX_N;++i) par[i] = 0;}st原创 2015-08-05 21:48:20 · 312 阅读 · 0 评论 -
poj2421kruskal算法模板题
#include #include using namespace std;#define MAX_N 110 #define MAX_E 11000static int N;static struct Edge{ int from; int to; int cost;}edge[MAX_E];static int E;static int cmp(Edge&原创 2015-08-05 22:20:50 · 539 阅读 · 0 评论 -
POJ1125Floyd-warshall算法模板题
//题意求出一个Num人并给出该人传递信息到最后一个收到该信息的的时间//floyd算法模板题//204K 0MS#include using namespace std;#define MAX_N 110#define INF 0x3f3f3f3fstatic int n;static int dp[MAX_N][MAX_N];static int G[MAX_N]原创 2015-08-03 20:41:57 · 454 阅读 · 0 评论 -
hdoj1281二分匹配查看是否为关键位置
#include #include #include using namespace std;#define MAX_N 105static int G[MAX_N][MAX_N];static int n,m;static int match[MAX_N];static int used[MAX_N];//有向图的匹配方式static bool dfs(int v){原创 2015-08-14 17:34:42 · 328 阅读 · 0 评论 -
poj1325最小顶点覆盖
//因为要完成所有的任务每个任务是一条线//因为机器A和B任一个做该任务就算完成了//那么这题的模型就是覆盖所以的边的最少的顶点数目//那么就是最小顶点覆盖问题//注意机器开始就在0上所有跟0的边可以删除#include #include #include #include using namespace std;#define MAX_N 1010static ve原创 2015-08-12 20:06:16 · 404 阅读 · 0 评论 -
POJ1459网络流模板题
//添加源点与汇点#include #include using namespace std;#define MAX_N 20005#define INF 1<<30static struct Edge{ int to; int v; int next;}edge[200000];static int head[MAX_N],tot;static void ad原创 2015-07-29 21:01:17 · 329 阅读 · 0 评论 -
POJ3159差分约束最短路径问题
#include #include using namespace std;#define MAX_N 30005#define MAX_E 150005#define INF 1<<30static int N,M;static struct Edge{ int from; int to; int cost; int next;};static struct原创 2015-07-27 14:25:46 · 349 阅读 · 0 评论 -
poj1062昂贵的聘礼有等级限制的最短路径
//主要问题是在最短路径过程中注意等级的差距//第一次原创 2015-06-14 00:43:21 · 270 阅读 · 0 评论 -
poj1797最大生成树
//1348K 454MS //注意不是生成整棵树而是只要可以到达N点就行了#include #include #include #include using namespace std;#define MAXE 1000005#define MAXN 1006static struct edge{ int from; int to; int cost;}原创 2015-09-18 20:31:11 · 408 阅读 · 0 评论