We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1641d25 commit a6e2503Copy full SHA for a6e2503
copypasta/trie01.go
@@ -3,11 +3,9 @@ package copypasta
3
import (
4
"math"
5
"math/bits"
6
+ "runtime/debug"
7
)
8
-// 注:由于用的是指针写法,必要时禁止 GC,能加速不少
9
-// func init() { debug.SetGCPercent(-1) }
10
-
11
// 异或字典树
12
// 一棵(所有叶节点深度都相同的)二叉树
13
// 模板题 LC421 https://leetcode.cn/problems/maximum-xor-of-two-numbers-in-an-array/
@@ -23,6 +21,10 @@ import (
23
21
// 转换 https://codeforces.com/contest/1720/problem/D2
24
22
// 异或和 ≥k 的最短区间 https://acm.hdu.edu.cn/showproblem.php?pid=6955
25
// https://codeforces.com/problemset/problem/1849/F
+
+// 指针写法关闭 GC 可以得到明显加速
26
+func init() { debug.SetGCPercent(-1) }
27
28
type trie01Node struct {
29
son [2]*trie01Node
30
cnt int // 子树叶子数
0 commit comments