摘要: PMT:部分匹配表(Partial Match Table) 表示含义:t[0,i] 的前后缀最大匹配长度 s = input() t = input() n,m = len(s),len(t) pmt = [0] * m c = 0 for i in range(1,m): x = t[i] wh 阅读全文
posted @ 2024-03-30 17:00 gebeng 阅读(27) 评论(0) 推荐(0)
摘要: 灵茶之KMP01 题目链接 https://codeforces.com/problemset/problem/1137/B 题目大意 输入两个长度均 ≤\(5* 10^5\) 的字符串 s 和字符串 t,只包含 '0' 和 '1'。 重排 s 中的字符,使得 s 中有尽量多的子串等于 t。 输出重 阅读全文
posted @ 2024-03-30 16:35 gebeng 阅读(15) 评论(0) 推荐(0)
摘要: 暴力美学,珂朵莉树! from sortedcontainers import SortedList class node: __slots__ = ['l', 'r', 'val'] def __init__(self, l, r, val): self.l = l self.r = r self 阅读全文
posted @ 2024-03-30 10:33 gebeng 阅读(20) 评论(0) 推荐(0)