上一页 1 ··· 24 25 26 27 28 29 30 31 32 ··· 47 下一页
摘要: 题目传送门 1 /* 2 KM: 相比HDOJ_1533,多了重边的处理,还有完美匹配的判定方法 3 */ 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 10 const int MAXN =... 阅读全文
posted @ 2015-07-20 19:52 Running_Time 阅读(213) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 最小费用流:KM算法是求最大流,只要w = -w就可以了,很经典的方法 3 */ 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 10 const int MAXN =... 阅读全文
posted @ 2015-07-20 19:50 Running_Time 阅读(349) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 KM:裸题第一道,好像就是hungary的升级版,不好理解,写点注释 3 KM算法用来解决最大权匹配问题: 在一个二分图内,左顶点为X,右顶点为Y,现对于每组左右连接Xi,Yj有权w(i,j), 4 求一种匹配使得所有w(i,j)的和... 阅读全文
posted @ 2015-07-20 17:02 Running_Time 阅读(341) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 BFS:三维BFS,坐标再加上步数,能走一个点当这个地方在步数内不能落到。因为雕像最多8步就会全部下落, 3 只要撑过这个时间就能win,否则lose 4 */ 5 #include 6 #include 7 #include 8 #inclu... 阅读全文
posted @ 2015-07-20 14:24 Running_Time 阅读(241) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 构造:从大到小构造,每一次都把最后不是9的变为9,p - p MOD 10^k - 1,直到小于最小值。 3 另外,最多len-1次循环 4 */ 5 #include 6 #include 7 #include 8 #include 9 us... 阅读全文
posted @ 2015-07-20 14:23 Running_Time 阅读(250) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 最短路: 不仅扫描边,还要扫描点;点有两种情况,一种刚好在中点,即从u,v都一样,那么最后/2 3 还有一种是从u,v不一样,两种的距离都是l 4 模板错了,逗了好久:( 5 */ 6 #include 7 #include... 阅读全文
posted @ 2015-07-19 21:37 Running_Time 阅读(211) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 贪心:当m == 2时,结果肯定是ABABAB或BABABA,取最小改变量;当m > 2时,当与前一个相等时, 改变一个字母 3 同时不和下一个相等就是最优的解法 4 */ 5 #include 6 #include 7 #include... 阅读全文
posted @ 2015-07-19 17:57 Running_Time 阅读(280) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 题意:求最少改变多少个0成1,使得每一个元素四周的和为偶数 3 状态压缩+枚举:枚举第一行的所有可能(1 7 #include 8 #include 9 using namespace std;10 11 const int MAXN = 20;12 con... 阅读全文
posted @ 2015-07-19 15:46 Running_Time 阅读(235) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 假设x1为1号给n号的金币数(逆时针),下面类似 3 a[1] - x1 + x2 = m(平均数) 得x2 = x1 + m - a[1] = x1 - c1; //规定c1 = a[1] - m,下面类似 4 a[2] - x2 + x3 = ... 阅读全文
posted @ 2015-07-19 14:17 Running_Time 阅读(215) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 贪心:按照执行时间长的优先来排序 3 */ 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std;11 12 const int ... 阅读全文
posted @ 2015-07-19 14:04 Running_Time 阅读(139) 评论(0) 推荐(0)
摘要: 二分专题int p=lower_bound(A,A+n,x)-A; //查询>=x的第一个下标int p=upper_bound(A,A+n,x)-A; //查询>x的第一个下标int p=upper_bound(A,A+n,x)-A-1; //查... 阅读全文
posted @ 2015-07-19 13:28 Running_Time 阅读(198) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 二分图判定+点染色:因为有很多联通块,要对所有点二分图匹配,若不能,存在点是无法分配的,no 3 每一次二分图匹配时,将点多的集合加大最后第一个集合去 4 注意:n 7 #include 8 #include 9 #includ... 阅读全文
posted @ 2015-07-19 13:27 Running_Time 阅读(283) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 数学:这题一直WA在13组上,看了数据才知道是计算cost时超long long了 3 另外不足一个区间的直接计算个数就可以了 4 */ 5 #include 6 #include 7 #include 8 #include 9 #incl... 阅读全文
posted @ 2015-07-19 13:09 Running_Time 阅读(229) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 贪心:暴力贪心水水 3 */ 4 #include 5 #include 6 #include 7 using namespace std; 8 9 const int MAXN = 1e2 + 10;10 const int INF = 0x3f3... 阅读全文
posted @ 2015-07-18 18:30 Running_Time 阅读(172) 评论(0) 推荐(0)
摘要: 题目传送门 1 /* 2 DP:先用l,r数组记录前缀后缀上升长度,最大值会在三种情况中产生: 3 1. a[i-1] + 1 7 #include 8 #include 9 using namespace std;10 11 const int MAXN = 1e5... 阅读全文
posted @ 2015-07-18 18:26 Running_Time 阅读(164) 评论(0) 推荐(0)
上一页 1 ··· 24 25 26 27 28 29 30 31 32 ··· 47 下一页