摘要: 给出点与点的关系 判断是否为仙人掌图#include#include#includeusing namespace std;#includeconst int INF = 1b?b:a;}int max(int a, int b){ return a>b?a:b;}int flag=0;#defin... 阅读全文
posted @ 2014-07-10 20:23 kewowlo 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 别人的解释感觉很赞POJ 1797题意:每条路都有一个重量限制求从1--n的路径中可通过的最大的重量思路:因为是取最大值 所以图的初始化应为-1d[u]中储存当前路径可以通行的最大质量更新时比较 先取 路径与前点的最小值 再与当前点比较取最大值(即更新)#include#include#includ... 阅读全文
posted @ 2014-07-09 23:35 kewowlo 阅读(126) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include #include #include #include using namespace std;#include #include #include #include #include #inc... 阅读全文
posted @ 2014-07-08 21:16 kewowlo 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 题意 :给你3个公式 给出x0,x1,y0,y1 算出矩阵 c在求出种类编号最小的数种类编号= Di%m; Di为0点到i点最短的距离;思路:给你3个公式因为( i*n+j )差不多是n*(n-1) 所以 X Y Z 都先算到n*(n-1)个然后得到邻接矩阵dijkstra得到最短路 d [ n ]... 阅读全文
posted @ 2014-07-08 18:48 kewowlo 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 存下每个数旁边的数字将 i 旁边的数中从小到大排序取中位数将 i 替换 中位数算翻的页数求出 ans值与mi比较大小#include #include #include #include #include #include using namespace std;const int N = 1000... 阅读全文
posted @ 2014-07-07 22:47 kewowlo 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 题意:1.互通的城市必须算一个州内2.存在一条路径可以算一个州内1. 想到强连通缩点2.二分匹配#include#include#includeusing namespace std;#includeconst int INF = 1b?b:a;}int max(int a, int b){ ret... 阅读全文
posted @ 2014-07-05 23:37 kewowlo 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 至少加几条边让整个图变成强连通入度为零的根节点数出度为零的子节点数取最大值#include#include#includeusing namespace std;#includeint min(int a,int b){ return a>b?b:a;}int max(int a, int b){ ... 阅读全文
posted @ 2014-07-05 21:20 kewowlo 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 转自九野博客:地址算法详解做强连通要注意特别是 taj 为 1 的情况#include#include#includeusing namespace std;#includeint min(int a,int b){ return a>b?b:a;}#define N 30 //N为最大点数 #... 阅读全文
posted @ 2014-07-05 19:45 kewowlo 阅读(130) 评论(0) 推荐(0) 编辑
摘要: /****************************Kruskal算法*****************************/int father[maxn],n,m;int find(int x){ if(father[x]!=x) father[x]=find(father[x]);... 阅读全文
posted @ 2014-07-05 15:02 kewowlo 阅读(200) 评论(0) 推荐(0) 编辑
摘要: /******************************************* 邻接表 储存图 空间复杂度O(m+n) 时间复杂度O(m) 优点: 缺点:********************************************/#include#defi... 阅读全文
posted @ 2014-07-04 21:36 kewowlo 阅读(171) 评论(0) 推荐(0) 编辑