摘要:
一个动态维护前缀和的工具 class BIT: def __init__(self, n): self.tree = [0] * (n + 1) self.n = n def lowbit(self, x): return x & -x def update(self, x, k): while x 阅读全文
posted @ 2024-03-31 20:00
gebeng
阅读(23)
评论(0)
推荐(0)
摘要:
曼哈顿距离 两个单元格 \((x_i, y_i)\)和\((x_j, y_j)\) 之间的曼哈顿距离为 \(|x_i - x_j| + |y_i - y_j|\) 进一步总结,求最大的 \((x_i + y_i)_{max}\) - \((x_i + y_i)_{min}\) 与 最大的 \((x_ 阅读全文
posted @ 2024-03-31 16:30
gebeng
阅读(92)
评论(0)
推荐(0)
摘要:
s = input() n = len(s) z = [0] * n left,right = 0,0 # z[i]表示s和s[i:]的LCP长度,规定z[0] = 0! for i in range(1,n): # 如果在z-box里,那么更新它的z[i]的值! if i <= right: z[ 阅读全文
posted @ 2024-03-31 10:27
gebeng
阅读(45)
评论(0)
推荐(0)

浙公网安备 33010602011771号