上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 21 下一页
摘要: 裸的点分治。。 及时把已经确定的询问清掉就能快不少。时间复杂度O(nlogn*p) 1 #include<cstdio> 2 #include<iostream> 3 #include<cstring> 4 #include<algorithm> 5 using namespace std; 6 c 阅读全文
posted @ 2016-06-18 22:36 czllgzmzl 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 直接把所有数的sg值算出来就行了。 1 #include<cstdio> 2 #include<iostream> 3 #include<cstring> 4 #include<algorithm> 5 using namespace std; 6 const int maxn=1002333; 7 阅读全文
posted @ 2016-06-18 22:32 czllgzmzl 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 首先最短路长度不同的人肯定不会冲突。 对于最短路长度相同的人,跑个最大流就行了。。当然只有一个人就不用跑了 看起来会T得很惨。。但dinic在单位网络里是O(m*n^0.5)的... 1 #include<cstdio> 2 #include<iostream> 3 #include<cstring 阅读全文
posted @ 2016-06-18 22:30 czllgzmzl 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 写了线段树合并。。具体合并姿势和可并堆基本一样。。 1 #include<cstdio> 2 #include<iostream> 3 #include<cstring> 4 #include<algorithm> 5 using namespace std; 6 const int maxn=10 阅读全文
posted @ 2016-06-18 22:17 czllgzmzl 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 比较蛋疼的是我们可以先染个底色,再在底色上染别的东西。 由ccz大爷的题解可得。。将目标状态里相同颜色的联通块缩点后,枚举起点,生成树里的最大节点深度就是需要的次数了, 如果最大深度是白色的话记得-1. 1 #include<cstdio> 2 #include<iostream> 3 #inclu 阅读全文
posted @ 2016-06-18 22:00 czllgzmzl 阅读(347) 评论(0) 推荐(0) 编辑
摘要: 问最小割中可能成为割边和一定会成为割边的边有哪些。 膜了半天各路题解。 比较详细的解释: http://blog.csdn.net/horizon_smz/article/details/50889806 1 #include<cstdio> 2 #include<iostream> 3 #incl 阅读全文
posted @ 2016-06-18 21:18 czllgzmzl 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 分块大法。。 1 #include<cstdio> 2 #include<iostream> 3 #include<cstring> 4 #include<algorithm> 5 #include<cmath> 6 using namespace std; 7 const int maxn=100 阅读全文
posted @ 2016-06-18 17:14 czllgzmzl 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 一个节点的儿子是否交换,不会影响到它和兄弟节点间的逆序对数。 所以每次合并线段树的时候算一下交换与不交换的逆序对数,然后选个较小值就行了。 1 #include<cstdio> 2 #include<iostream> 3 #include<cstring> 4 #include<algorithm 阅读全文
posted @ 2016-06-18 17:09 czllgzmzl 阅读(210) 评论(0) 推荐(0) 编辑
摘要: 莫队+分块。。分块修改O(1),查询O(n^0.5) 总复杂度O(n^1.5) 1 #include<cstdio> 2 #include<iostream> 3 #include<cstring> 4 #include<algorithm> 5 #include<cmath> 6 #define 阅读全文
posted @ 2016-06-18 17:05 czllgzmzl 阅读(259) 评论(0) 推荐(0) 编辑
摘要: 结论题。。。一棵树里用到的颜色数不超过logn。。 f[i][j]表示以i为根的子树里,i的颜色是j的方案数。 g[i][j]表示max{f[i][k]},(k!=j 1 #include<cstdio> 2 #include<iostream> 3 #include<cstring> 4 #inc 阅读全文
posted @ 2016-06-18 17:03 czllgzmzl 阅读(159) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 21 下一页