字典树
mmk27
这个作者很懒,什么都没留下…
展开
-
HDU - 1251 统计难题 (字典树模板)
Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀). Input 输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单词,一个空行代表单词表的结束.第二部分是一连串的提问,每行一个提问,每个提问都是一个字符串. 注意:...原创 2018-10-24 15:10:59 · 134 阅读 · 0 评论 -
HDU - 4825 Xor Sum 01字典树
题目链接:https://vjudge.net/problem/HDU-4825 题解:字典树保存下来,从高位到低位处理 #include <bits/stdc++.h> using namespace std; const int N = 100010; struct node { int nex[2]; int sum; }tree[N * 35]; int n, m, ...原创 2019-08-16 15:38:39 · 135 阅读 · 0 评论 -
HDU - 5536 Chip Factory 01字典树
题目链接:https://vjudge.net/problem/HDU-5536#author=SCU2018 题意:求max( (a[i] + a[j]) xor a[k] ) (i, j, k互不相同) 题解:因为n只有1000,所以可以枚举 i j,然后其他数建字典树,对应直接查询即可 #include <bits/stdc++.h> using namespace st...原创 2019-08-16 15:26:16 · 125 阅读 · 0 评论 -
2019 杭电多校 HDU - 6625 three arrays 字典树+贪心
题目链接:https://cn.vjudge.net/problem/HDU-6625 题意:a和b两个数组n个数,数字任意组合异或,求得到c数组的字典序最小 题解:对于两个数组从高位到低位建立两个字典树,然后从高位到低位这样走,如果接下来的位两者都有的话,就走一样的,否则就走不一样的,就是一种贪心的策略。最后排一下序即可,鑫爷tql #include <bits/stdc++.h&...原创 2019-08-06 13:50:08 · 705 阅读 · 7 评论 -
POJ - 1451 T9 字典树
题目连接:点击查看 Background A while ago it was quite cumbersome to create a message for the Short Message Service (SMS) on a mobile phone. This was because you only have nine keys and the alphabet has more...原创 2019-02-27 18:44:43 · 238 阅读 · 0 评论 -
HDU - 6191 Query on A Tree 01字典树 + 可持久化
Monkey A lives on a tree, he always plays on this tree. One day, monkey A learned about one of the bit-operations, xor. He was keen of this interesting operation and wanted to practise it at once. Mon...原创 2018-12-06 13:35:43 · 308 阅读 · 0 评论 -
Gym - 100548I International Collegiate Routing Contest 字典树
Description You may know thatBluegao University (formly Bluefly University) is famous ofnetworking technology. One day, their headmaster Yuege received aspecial router, along with a task about routin...原创 2018-10-30 14:13:00 · 143 阅读 · 0 评论 -
CodeForces - 633C Spy Syndrome 2 字典树+dfs
After observing the results of Spy Syndrome, Yash realised the errors of his ways. He now believes that a super spy such as Siddhant can't use a cipher as basic and ancient as Caesar cipher. After man...原创 2018-10-24 17:33:44 · 145 阅读 · 0 评论 -
POJ - 3630 / HDU - 1671 Phone List (字典树模板)
POJ 的不要动态开辟POJ 的不要动态开辟POJ 的不要动态开辟POJ 的不要动态开辟POJ 的不要动态开辟POJ 的不要动态开辟 POJ 的不要动态开辟POJ 的不要动态开辟POJ 的不要动态开辟POJ 的不要动态开辟POJ 的不要动态开辟POJ 的不要动态开辟 POJ 的不要动态开辟POJ 的不要动态开辟POJ 的不要动态开辟POJ 的不要动态开辟POJ 的不要动态开辟POJ 的不要动态...原创 2018-10-24 15:46:30 · 167 阅读 · 0 评论 -
HYSBZ - 3261 最大异或和 可持久化字典树
题目链接:https://vjudge.net/problem/HYSBZ-3261#author=upc_201713 有M个操作,有以下两种操作类型: 1、A x:添加操作,表示在序列末尾添加一个数x,序列的长度N+1。 2、Q l r x:询问操作,你需要找到一个位置p,满足l<=p<=r,使得: a[p] xor a[p+1] xor ... xor a[N] xor ...原创 2019-08-16 17:08:38 · 114 阅读 · 0 评论