随笔分类 - 图论
摘要:Network Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 5665 Accepted: 1602 Description Yixght is a manager of the company called SzqNetwor
阅读全文
摘要:#include #include #include #include #include using namespace std; struct my{ int next; int v; }; const int maxn=10000; int adj[maxn],low[maxn],dfsn[maxn],dfn,fa,id[maxn],sadj[maxn],sfa; my bi...
阅读全文
摘要:#include #include #include using namespace std; struct my{ int next; int v; }; const int maxn=10000; int low[maxn],dfsn[maxn],adj[maxn],fa,sfa,dfn; int bs[maxn],cnt; bool bridge[maxn*2]; in...
阅读全文
摘要:#include #include #include using namespace std; typedef long long ll; struct my{ int next; int v; }; const int maxn=100000+10; ll low[maxn],dfsn[maxn],size_[maxn],adj[maxn],fa,dfn,root,ans[ma...
阅读全文
摘要:一,无向图的割点与桥 对于G=(V,E) 1.割点:xξV若删除x以及与x所连边后,图被分裂成为多个联通图,则x为图的割点 2.桥(割边):eξE若删除e后图,图被分裂成为多个联通图,则e为图的割点 怎样求割点与割边 tarjan算法 就是他了。。。 首先我们引入时间戳的概念 设dfsn[x]表示从
阅读全文
摘要:Sightseeing trip Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7483 Accepted: 2827 Special Judge Description There is a travel agency in
阅读全文
摘要:匹配:一个图中选出一些边来使得任意边所连接的顶点不同, 最大匹配:边数最多的匹配 最大权匹配:边权最大的匹配 完美匹配:所有节点都包括的匹配 覆盖:无向图的一个顶点子集,使得边集中任意一条边都至少一个顶点在这个子集中 最小边覆盖:点最少的覆盖 最小边覆盖数=最大匹配数 独立集:一个无向图中不存在一条
阅读全文
摘要: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))]两部分 然后在其中取最大值 ,满足最
阅读全文
摘要:求出一个这个工程的工作序列的算法被成为拓扑排序。比如说 1,5,2,3,6,4 就可以算作一个工作序列。拓扑排序的过程大概是这样的:1 选择一个入度为 0 的结点并直接输出。2 删除这个结点以及与它关联的所有边。3 重复步骤 (1) 和 (2),直到找不到入度为 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=
阅读全文
摘要:#include <vector> #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #define maxn 1005 #define maxm 1000005 using namespace
阅读全文
摘要:#include<cstdio> #include<algorithm> #include<cstring> #include<stack> using namespace std; struct my{ int v,next; }; my bian[200000+10]; my bian2[200
阅读全文
摘要:#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
阅读全文
摘要:#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
阅读全文
摘要:1. 欧拉通路、欧拉回路、欧拉图无向图:1) 设G是连通无向图,则称经过G的每条边一次并且仅一次的路径为欧拉通路;2) 如果欧拉通路是回路(起点和终点是同一个顶点),则称此回路为欧拉回路(Euler circuit);3) 具有欧拉回路的无向图G称为欧拉图(Euler graph)。有向图:1) 设
阅读全文

浙公网安备 33010602011771号