2023年3月8日
摘要: 给定一棵 nn 个点的带权树,结点下标从 11 开始到 nn。寻找树中找两个结点,求最长的异或路径。 异或路径指的是指两个结点之间唯一路径上的所有边权的异或。 处理出每个点的树上异或前缀 这些异或值按照二进制数插入Trie 经典问题了 #include <iostream> #include <cs 阅读全文
posted @ 2023-03-08 20:20 towboat 阅读(21) 评论(0) 推荐(0)
摘要: 查找单词个数 样例: 3 9 you are a good boy ha ha o yeah 13 o my god you like bleach naruto one piece and so do i 11 but i do not think you will get all the poi 阅读全文
posted @ 2023-03-08 19:49 towboat 阅读(23) 评论(0) 推荐(0)
摘要: 求num[i] ,表示1~i前缀 的合法子串个数( 满足前后缀相等,且不重合 #include <iostream> #include <cstring> using namespace std; const int N =1e6+3 ,mod= 1e9+7; #define int long lo 阅读全文
posted @ 2023-03-08 16:37 towboat 阅读(36) 评论(0) 推荐(0)
摘要: 希望在Str 中删掉 1个屏蔽词(一个屏蔽词可能出现多次) 求最后的串 栈+hash #include <iostream> #include <cstring> using namespace std; const int N =1e6+3; #define int long long int b 阅读全文
posted @ 2023-03-08 15:23 towboat 阅读(15) 评论(0) 推荐(0)
摘要: 对于给定串的每个前缀i,求最长的,使 这个字符串重复两边能覆盖原前缀i的前缀(就是前缀i的一个前缀),求所有的这些“前缀的前缀”的长度和 一张图秒懂 求next[] , 对于前缀i ,设 j =next[i] , 他有一个周期 i- j #include <bits/stdc++.h> using 阅读全文
posted @ 2023-03-08 14:55 towboat 阅读(26) 评论(0) 推荐(0)