字典树
文章平均质量分 81
qq_37383726
这个作者很懒,什么都没留下…
展开
-
字典树 【知识点 +模板】
模版链接 建树 的过程剖析#include <bits/stdc++.h>using namespace std;#define inf 0x3f3f3f3f#define LL long longconst int MAXN = 100000;const int MAXM = 1e6+100;const double PI = acos(-1.0);const double eps原创 2017-06-01 00:29:53 · 204 阅读 · 0 评论 -
【第八届河南理工大学程序设计大赛(正式赛)】 BDE F GHIJKLM
问题 F: GCD与LCM 题目描述 Ocean某天遇到了一个很简单的数学题,但是他的大脑已经超负荷了。现在请你帮帮他吧:已知D = GCD(x, y) + LCM(x, y),求合法组合(x, y)总数,其中x > 0且y > 0。输入 第一行输入一个整数T,代表有T组测试数据。接下来每行输入一个整数D。注:1<=T,D<=1051<=T,D<=105。输出 对每组测试数据,输出一个整数代原创 2017-12-11 21:28:20 · 1260 阅读 · 0 评论 -
【51Nod - 1295】XOR key 【可持久化 01Trie】
给出一个长度为N的正整数数组A,再给出Q个查询,每个查询包括3个数,L, R, X (L <= R)。求ALL 至 ARR 这R - L + 1个数中,与X 进行异或运算(Xor),得到的最大值是多少? Input 第1行:2个数N, Q中间用空格分隔,分别表示数组的长度及查询的数量(1 <= N <= 50000, 1 <= Q <= 50000)。 第2 - N+1行:每行1个数,对应数原创 2017-10-31 13:24:46 · 292 阅读 · 0 评论 -
【HDU - 4757】Tree 【LCA+持久化01 Trie】
Zero and One are good friends who always have fun with each other. This time, they decide to do something on a tree which is a kind of graph that there is only one path from node to node. First, Zero w原创 2017-11-02 00:15:58 · 272 阅读 · 0 评论 -
【POJ - 3764 】The xor-longest Path 【01 Trie + DFS +异或恒等式】
In an edge-weighted tree, the xor-length of a path p is defined as the xor sum of the weights of edges on p:{xor}length(p)=\oplus{e \in p}w(e) ⊕ is the xor operator.We say a path the xor-longest path原创 2017-10-31 21:38:49 · 364 阅读 · 0 评论 -
【HDU - 6191 】Query on A Tree 【 可持久01Trie +DFS序 】
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. Monk原创 2017-10-31 23:53:29 · 407 阅读 · 0 评论 -
【HDU - 4825】 Xor Sum 【01 Trie -- 静态区间查询】
Zeus 和 Prometheus 做了一个游戏,Prometheus 给 Zeus 一个集合,集合中包含了N个正整数,随后 Prometheus 将向 Zeus 发起M次询问,每次询问中包含一个正整数 S ,之后 Zeus 需要在集合当中找出一个正整数 K ,使得 K 与 S 的异或结果最大。Prometheus 为了让 Zeus 看到人类的伟大,随即同意 Zeus 可以向人类求助。你能证明人类的原创 2017-10-30 21:44:29 · 226 阅读 · 0 评论 -
【CodeForces - 706D 】Vasiliy's Multiset 【01 Trie 插入删除查询操作】
Author has gone out of the stories about Vasiliy, so here is just a formal task description.You are given q queries and a multiset A, initially containing only integer 0. There are three types of queri原创 2017-10-31 18:09:15 · 207 阅读 · 0 评论 -
【HDU - 5536】Chip Factory 【01 Trie 插入删除询问操作】
John is a manager of a CPU chip factory, the factory produces lots of chips everyday. To manage large amounts of products, every processor has a serial number. More specifically, the factory produces n原创 2017-10-31 17:49:32 · 247 阅读 · 0 评论 -
统计难题 【字典树模版】
Problem Description Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀).Input 输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单词,一个空行代表单词表的结束.第二部分是一连串的提问,每行一个提原创 2017-06-13 00:02:06 · 233 阅读 · 0 评论 -
Hat’s Words 【字典树 判断字符串是否可以为字符串集中两个字符串组成】
Problem Description A hat’s word is a word in the dictionary that is the concatenation of exactly two other words in the dictionary. You are to find all the hat’s words in a dictionary.Input Standar原创 2017-06-13 21:54:20 · 354 阅读 · 0 评论 -
Phone List 【字典树 字符串集中 一个字符串是否为另一个的字符串的前缀】
Description Given a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let’s say the phone catalogue listed these numbers: Emergency 911 Alice原创 2017-06-13 21:04:32 · 241 阅读 · 0 评论 -
Shortest Prefixes 【字典树 求给定字符串的 最短确定前缀】
A prefix of a string is a substring starting at the beginning of the given string. The prefixes of “carbon” are: “c”, “ca”, “car”, “carb”, “carbo”, and “carbon”. Note that the empty string is not consi原创 2017-06-13 01:34:05 · 528 阅读 · 0 评论 -
【牛客练习赛11】 B 假的字符串【字典树+topo判环】
链接:https://www.nowcoder.com/acm/contest/59/B 来源:牛客网时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言65536K 64bit IO Format: %lld 题目描述 给定n个字符串,互不相等,你可以任意指定字符之间的大小关系(即重定义字典序),求有多少个串可能成为字典序最小的串,并输出它们原创 2018-01-28 13:39:17 · 661 阅读 · 0 评论