trie
SSL_GYX
座右铭:言念君子,温其如玉。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
【ybt】【字符串 trie 课过 例4】阅读理解
英语老师留了 篇阅读理解作业,但是每篇英文短文都有很多生词需要查字典,为了节约时间,现在要做个统计,算一算某些生词都在哪几篇短文中出现过。原创 2021-04-01 17:00:15 · 177 阅读 · 0 评论 -
【ybt】【字符串 trie 课过 例3】最长异或路径
最长异或路径 题目链接:最长异或路径 题目描述 解题思路 我们可以预处理出从根节点到每一个节点路径上所有边权的异或值。 然后就和前缀统计一样了。 code #include<iostream> #include<cstdio> using namespace std; int n,ans; int a[1000010]; int v[1000010]; int hd[1000010],tot; int trie[1000010][2]; struct abc{ int to原创 2021-03-31 17:21:13 · 177 阅读 · 0 评论 -
【ybt】【字符串 trie 课过 例2】最大异或对
最大异或对 题目链接:最大异或对 题目描述 解题思路 我们可以将每个数拆分成二进制,存入字典树中。 二进制数字越高位换算成十进制数字就越大,所以我们要从高位到低位存数,对于不够 313131 位的数字补全。 题目要求异或后的数尽量大,换句话说就是要在查找的时候尽量往不同的数字去找,最后取 max\maxmax 值就可以了。 code #include<iostream> #include<cstdio> using namespace std; int n,ans; int原创 2021-03-31 16:48:25 · 125 阅读 · 0 评论 -
【ybt】【字符串 trie 课过 例1】前缀统计
> Trie树模板题原创 2021-03-24 17:33:19 · 137 阅读 · 0 评论
分享