摘要: 求出最小生成树后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 阅读(142) 评论(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 阅读(202) 评论(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 阅读(120) 评论(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 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 求出一个这个工程的工作序列的算法被成为拓扑排序。比如说 1,5,2,3,6,4 就可以算作一个工作序列。拓扑排序的过程大概是这样的:1 选择一个入度为 0 的结点并直接输出。2 删除这个结点以及与它关联的所有边。3 重复步骤 (1) 和 (2),直到找不到入度为 0 的结点。通常情况下,在实现的时候 阅读全文
posted @ 2018-01-22 19:30 lmjer 阅读(875) 评论(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 阅读(125) 评论(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 阅读(152) 评论(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 阅读(119) 评论(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 阅读(95) 评论(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 阅读(121) 评论(0) 推荐(0) 编辑