上一页 1 ··· 8 9 10 11 12 13 14 15 下一页
摘要: 1.为什么最小交换次数是求数组的逆序数?比如91054 9作为最大,它肯定要沉到最后面,所以肯定要交换4次 并且9的逆序数 (9,1)(9,0)(9,5)(9,4) 正好是4, 同时9沉下去后,其他数字的相对位置没有改变,同样的道理一个数有多少个逆序数就要交换多... 阅读全文
posted @ 2018-03-18 16:27 LandingGuys 阅读(90) 评论(0) 推荐(0) 编辑
摘要: 并查集 食物链 http://poj.org/problem?id=1182 题解 请移步http://blog.csdn.net/niushuai666/article/details/6981689创新的亮点1 在找爸爸的时候更新关系。2 判断两者的关系运用的向... 阅读全文
posted @ 2018-03-17 20:56 LandingGuys 阅读(100) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #define MAX 5000#define INF 999999using namespace std;typedef pair p;//first最短距离 second 顶点编号struct edge{int... 阅读全文
posted @ 2018-03-17 17:48 LandingGuys 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 自己的理解:匹配 :两条边没有公共顶点 的边的集合最小边覆盖:取n条边 这n条边的顶点是图的全部顶点 且n最小最大独立集:两两顶点互相之间不相连 这些定点个数的最大值最小顶点覆盖:n个顶点和 从这些顶点出发能够连的顶点 是图的全部顶点 且 n最小 ... 阅读全文
posted @ 2018-03-17 15:35 LandingGuys 阅读(142) 评论(0) 推荐(0) 编辑
摘要: http://blog.csdn.net/chenzhenyu123456/article/details/46431763 阅读全文
posted @ 2018-03-17 14:34 LandingGuys 阅读(73) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #define INF 999999#define M 201using namespace std;int n,m,pre[M],cap[M][M],flow[M][M],res[M];int ... 阅读全文
posted @ 2018-03-17 11:13 LandingGuys 阅读(76) 评论(0) 推荐(0) 编辑
摘要: 方法一 利用low-bound函数 lower_bound()函数需要加载头文件#include,其基本用途是查找有序区间中第一个大于或等于某给定值的元素的位置#include #include #define INF 999999using namespace st... 阅读全文
posted @ 2018-03-17 09:47 LandingGuys 阅读(90) 评论(0) 推荐(0) 编辑
摘要: 懒惰标记这个知识点 可以参考 http://blog.csdn.net/weizhuwyzc000/article/details/50445710最主要的是位运算 利用位或(只要对应的二个二进位有一个为1时,结果位就为1) 比如111 表示这个区间红黄蓝都有 则另一... 阅读全文
posted @ 2018-03-16 21:26 LandingGuys 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 首先是题目:找出几个序列的逆序数,并输出其中最小的逆序数。线段树:读入第n个数,树的叶子代表的是——在n之前读入的数的出现 ,比如当读入1时 ,在此之前已经读入了2 ,则树的第二个叶子就设置为1 (1表示出现过,开始初始化为0),在此之前已经读入了3,则树的第三个叶子... 阅读全文
posted @ 2018-03-16 20:33 LandingGuys 阅读(85) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std;int t,n,as[50005],cas=1,first,last,num,sum[50005>1; buildtree(l,m,rt>1; if(k>1; if(k>1; int ... 阅读全文
posted @ 2018-03-15 20:30 LandingGuys 阅读(85) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 下一页