题目:http://acm.hdu.edu.cn/showproblem.php?pid=5589对于u,v的xor和就是u到根的xor和 xor上 v到根的xor和。看到nm,那么用二进制拆分的思想,建一棵字典树,维护字典树的子树大小。显然>m时,从大到小枚举二进制位,存在xor和的某个二进制位为...
bzoj3261 设b[i]=a[1]^a[2]^...^a[i],所以题目所求可以转化为b[p-1]^b[n]^x,于是可持久化trie树lg。。。 fatheryoung的题解太美,在这里@一下http://www.cnblogs.com/y7070/p/5000471.html 1 #...
分类:
其他好文 时间:
2015-11-27 17:16:58
阅读次数:
180
可持久化Trie树和可持久化线段树很像,依次插入信息,通过减法来进行历史版本查询。2015年11月12日 bzoj3261 最大异或和 我们需要计算a[p] xor a[p+1] xor ... xor a[N] xor x ,设 sum[i] 表示 a[1] xor a[2] xor .....
分类:
其他好文 时间:
2015-11-27 14:46:57
阅读次数:
144
publicclassWordDictionary{privateTrieNoderoot=newTrieNode();publicvoidaddWord(Stringword){Mapchildren=root.children;for(inti=0;ichildren=tn.children;T...
分类:
其他好文 时间:
2015-11-27 01:00:38
阅读次数:
172
很多时候,学习总是止于实现,因为有很多这样或者那样的问题。即便是你理解了这种结构,但是实现起来却是另外一番天地,实践,看源码,然后继续实现是现阶段我应该完成的事情。 这次来学习一下字典树。 字典树,就是对树结构的一种特殊处理。对于英文词典来说,26个英文字母可以任意组合,那么这个树必然是26...
分类:
编程语言 时间:
2015-11-26 15:20:04
阅读次数:
189
Revenge of Fibonacci Time Limit: 10000/5000 MS (Java/Others)Memory Limit: 204800/204800 K (Java/Others) ...
分类:
其他好文 时间:
2015-11-22 18:33:53
阅读次数:
148
统计难题 Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 131070/65535 K (Java/Others) ...
分类:
其他好文 时间:
2015-11-22 11:05:11
阅读次数:
149
Revenge of FibonacciProblem DescriptionThe well-known Fibonacci sequence is defined as following:Here we regard n as the index of the Fibonacci number...
分类:
其他好文 时间:
2015-11-21 00:43:01
阅读次数:
182
#include #include #include #include #include #include #include using namespace std;const int N = 100010;struct Tree{ int v; struct Tree *pchild[...
分类:
其他好文 时间:
2015-11-20 17:01:23
阅读次数:
103
Tire树,又叫字典树,主要是用来查找单词,词频统计的.老规矩,直接上代码.package tireTree;public class TireTree { TireNode root; public TireTree(TireNode root) { this.root = root; } pr....
分类:
编程语言 时间:
2015-11-15 06:08:27
阅读次数:
1011