01 2018 档案

摘要:最大独立集与最小顶点覆盖互补 阅读全文
posted @ 2018-01-30 18:18 lmjer 阅读(129) 评论(0) 推荐(0)
摘要:匹配:一个图中选出一些边来使得任意边所连接的顶点不同, 最大匹配:边数最多的匹配 最大权匹配:边权最大的匹配 完美匹配:所有节点都包括的匹配 覆盖:无向图的一个顶点子集,使得边集中任意一条边都至少一个顶点在这个子集中 最小边覆盖:点最少的覆盖 最小边覆盖数=最大匹配数 独立集:一个无向图中不存在一条 阅读全文
posted @ 2018-01-30 11:48 lmjer 阅读(162) 评论(0) 推荐(0)
摘要:二分图最小覆盖数=最大匹配数 建模后即可 #include<cstdio>#include<cstring>#include<algorithm>using namespace std;struct my{ int next; int v;};const int maxn=1000000+10;co 阅读全文
posted @ 2018-01-30 11:27 lmjer 阅读(117) 评论(0) 推荐(0)
摘要:求出最小生成树后lca找最大权即可 #include<cstdio>#include<algorithm>#include<cstring>using namespace std;struct my{ int v; int next; int dist;};struct node{ int x,y; 阅读全文
posted @ 2018-01-28 11:37 lmjer 阅读(151) 评论(0) 推荐(0)
摘要:1.RMQ 即区间最值查询,如给定一个序列A,让你求形如[1,4]或[3,8]最值问题,用动态规划求解 设dp[i][j]表示从i到2^j的最值,那么dp[i][0]=a[i], dp[i][j]可划分成dp[i][j-1]与dp[i][i+(1<<(j-1))]两部分 然后在其中取最大值 ,满足最 阅读全文
posted @ 2018-01-28 11:36 lmjer 阅读(217) 评论(0) 推荐(0)
摘要:将一个节点扩展成为八个节点 #include<cstdio>#include<algorithm>#include<cstring>#include<queue>using namespace std;struct my{ int v; int next; int dist;};struct nod 阅读全文
posted @ 2018-01-25 20:53 lmjer 阅读(134) 评论(0) 推荐(0)
摘要:#include<cstdio>#include<cstring>#include<queue>#include<algorithm>using namespace std;struct my{ int v; int next; int dist;};const int maxn=10000;int 阅读全文
posted @ 2018-01-23 19:32 lmjer 阅读(181) 评论(0) 推荐(0)
摘要:求出一个这个工程的工作序列的算法被成为拓扑排序。比如说 1,5,2,3,6,4 就可以算作一个工作序列。拓扑排序的过程大概是这样的:1 选择一个入度为 0 的结点并直接输出。2 删除这个结点以及与它关联的所有边。3 重复步骤 (1) 和 (2),直到找不到入度为 0 的结点。通常情况下,在实现的时候 阅读全文
posted @ 2018-01-22 19:30 lmjer 阅读(913) 评论(0) 推荐(0)
摘要:#include<stdio.h>#include<cstring>#include<queue>#include<algorithm>using namespace std;struct my{ int v; int next; int dist;};int m,n;const int maxn= 阅读全文
posted @ 2018-01-22 18:22 lmjer 阅读(135) 评论(0) 推荐(0)
摘要:#include <vector> #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #define maxn 1005 #define maxm 1000005 using namespace 阅读全文
posted @ 2018-01-21 17:03 lmjer 阅读(159) 评论(0) 推荐(0)
摘要:#include<cstdio>#include<algorithm>#include<cstring>#include<queue>using namespace std;struct my{ int v; int next; double dist;};int m,n;const int max 阅读全文
posted @ 2018-01-21 12:07 lmjer 阅读(128) 评论(0) 推荐(0)
摘要:求出各点与终点的距离 ,然后在求得的DAG 上做动规 #include<cstdio>#include<cstring>#include<queue>#include<algorithm>using namespace std;struct my{ int v; int next; int dist 阅读全文
posted @ 2018-01-20 19:24 lmjer 阅读(108) 评论(0) 推荐(0)
摘要:2-sat 找好怎样连边即可 #include<cstdio>#include<algorithm>#include<cstring>using namespace std;const int maxn=1000000;bool mark[maxn*2+10];int age[maxn*2];int 阅读全文
posted @ 2018-01-18 19:26 lmjer 阅读(129) 评论(0) 推荐(0)
摘要:求图的缩点 阅读全文
posted @ 2018-01-07 11:58 lmjer 阅读(186) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<cstring> #include<stack> #include<algorithm> using namespace std; struct my{ int v; int next; }; my bian[1000000+10]; stack< 阅读全文
posted @ 2018-01-07 11:57 lmjer 阅读(152) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<algorithm> #include<cstring> #include<stack> using namespace std; struct my{ int v,next; }; my bian[200000+10]; my bian2[200 阅读全文
posted @ 2018-01-07 11:55 lmjer 阅读(218) 评论(0) 推荐(0)
摘要:#include<cstdio>#include<algorithm>#include<cstring>#include<stack>using namespace std;struct my{ int v; int next; int id;};my bian[2000000+10];int ad 阅读全文
posted @ 2018-01-05 19:20 lmjer 阅读(129) 评论(0) 推荐(0)
摘要:#include<cstdio>#include<cstring>#include<algorithm>using namespace std;struct my{ int v; int next;};struct dage{ int u; int v;};dage gebian[1000000*2 阅读全文
posted @ 2018-01-04 19:29 lmjer 阅读(146) 评论(0) 推荐(0)
摘要:1. 欧拉通路、欧拉回路、欧拉图无向图:1) 设G是连通无向图,则称经过G的每条边一次并且仅一次的路径为欧拉通路;2) 如果欧拉通路是回路(起点和终点是同一个顶点),则称此回路为欧拉回路(Euler circuit);3) 具有欧拉回路的无向图G称为欧拉图(Euler graph)。有向图:1) 设 阅读全文
posted @ 2018-01-02 19:06 lmjer 阅读(252) 评论(0) 推荐(0)
摘要:题意:给你n个珠子,一个珠子分为两半有两种颜色,用1到50来表示50种不同的颜色。把这些珠子串起来,两个紧挨着的珠子要满足一个条件就是接触的那部分颜色要相同 例如(1,2)(2,4),两个珠子的接触部分颜色相同都为2。当然,因为珠子最后是连成环的,第一个珠子和最后一个珠子也会接触,也要买满足这个条件 阅读全文
posted @ 2018-01-02 19:02 lmjer 阅读(202) 评论(0) 推荐(0)