Given the root of a tree, you are asked to find the most frequent subtree sum. The subtree sum of a node is defined as the sum of all the node values ...
分类:
其他好文 时间:
2020-01-23 09:17:11
阅读次数:
93
$K D\ Tree$是一种可以高效处理$k$维空间信息的数据结构 $K D\ Tree$具有二叉搜索树的形态,二叉搜索树上的每个结点都对应$k$维空间内的一个点。其每个子树中的点都在一个$k$维的超长方体内,这个超长方体内的所有点也都在这个子树中 同时用$ma$和$mi$来记录划分出的子空间的边界 ...
分类:
其他好文 时间:
2020-01-23 00:11:45
阅读次数:
65
树上数颜色,因为是查询子树,所以用 $dfn$ 序将树上问题转化为序列问题,然后就是裸的莫队数颜色了。 统计答案时还需注意一些细节问题,实现就看代码。 时间复杂度为 $O(n\sqrt{n})$。 $code:$ ...
分类:
其他好文 时间:
2020-01-22 23:54:21
阅读次数:
127
nginx单个IP访问频率限制 一、限制所有单个ip的访问频率 1、http中的配置 http { #$limit_conn_zone:限制并发连接数 limit_conn_zone $binary_remote_addr zone=one1:10m; #limit_req_zone:请求频率 #$ ...
分类:
其他好文 时间:
2020-01-22 23:53:20
阅读次数:
147
$Link\ Cut\ Tree$(动态树)用实链剖分来实现,维护的对象为一个森林,将原树剖分为若干个辅助树,辅助树用$Splay$来维护 辅助树内部用实边连接,辅助树之间用虚边连接,虚边总是由一棵$Splay$指向另一棵$Splay$的根,即为其中序遍历的第一个点 因为虚边是$Splay$之间相连 ...
分类:
其他好文 时间:
2020-01-22 22:13:15
阅读次数:
123
// int64 转字节数组 func IntToHex(num int64) []byte { buf := new(bytes.Buffer) err := binary.Write(buf, binary.BigEndian, num) if err != nil { log.Panic(er ...
分类:
其他好文 时间:
2020-01-22 18:35:11
阅读次数:
82
ExpressionBuilder https://github.com/Drutol/MALClient/tree/mal-alternative-api/ExpressionBuilder Welcome to the ExpressionBuilder classes! The Express ...
分类:
其他好文 时间:
2020-01-22 18:34:25
阅读次数:
96
二分法总结:满足某个条件的first position of。。。。 和 last position of。。。。用二分法 先从二分法开始写: 4点: 1.start+1<end; 退出条件两个相邻了就退出 2.mid=start+(end-start)/2;//防止溢出 3.A[mid] == > ...
分类:
其他好文 时间:
2020-01-22 14:44:16
阅读次数:
80
std::vector<int> tree[maxn]; int fa[maxn]; void dfs(int u,int father) { int len = tree[u].size(); for (int i = 0;i < len;i++) { int v = tree[u][i]; if ...
分类:
其他好文 时间:
2020-01-22 14:26:30
阅读次数:
46
Given a binary tree root and an integer target, delete all the leaf nodes with value target. Note that once you delete a leaf node with value target, ...
分类:
其他好文 时间:
2020-01-22 11:06:54
阅读次数:
64