当前位置:网站首页>[learning notes] border and period
[learning notes] border and period
2022-07-28 10:09:00 【Ants looking up at the starry sky】
Actually, it's just copying blogs
Weak periodic theorem
1.1 1.1 1.1 if p p p and q q q yes s s s The cycle of , p + q ≤ ∣ s ∣ p+q\le |s| p+q≤∣s∣, be gcd ( p , q ) \gcd(p,q) gcd(p,q) Also for the s s s The cycle of
prove :
Might as well set p < q p<q p<q, remember d = q − p d=q-p d=q−p
because p + q ≤ ∣ s ∣ p+q\le |s| p+q≤∣s∣, about ∀ i ∈ [ 1 , ∣ s ∣ − d ] , i − p ≥ 1 ∨ i + q ≤ n \forall i\in [1,|s|-d],i-p\ge 1\lor i+q\le n ∀i∈[1,∣s∣−d],i−p≥1∨i+q≤n
If the former holds , s i = s i − p = s i − p + q = s i + d s_i=s_{i-p}=s_{i-p+q}=s_{i+d} si=si−p=si−p+q=si+d
If the latter is established , s i = s i + q = s i + q − p = s i + d s_i=s_{i+q}=s_{i+q-p}=s_{i+d} si=si+q=si+q−p=si+d
so d d d by s s s The cycle of
Obviously, you can finally get gcd ( p , q ) \gcd(p,q) gcd(p,q) yes s s s The cycle of
border Structure
1.2 1.2 1.2 if 2 ∣ S ∣ ≥ ∣ T ∣ 2|S|\ge |T| 2∣S∣≥∣T∣, be S S S stay T T T The matching position in must be an arithmetic sequence .
prove :
First the T T T It's not being S S S Remove the covered part
Consider matching as greater than 2 2 2 The situation of
set up S S S stay T T T The first and second matching bit difference in is d d d, The bit difference between the second match and a later match is q q q, that d , q d,q d,q Are all S S S The cycle of , also d + q ≤ ∣ S ∣ d+q\le |S| d+q≤∣S∣, According to the weak periodic theorem r = gcd ( d , q ) r=\gcd(d,q) r=gcd(d,q) yes S S S The cycle of , set up S S S The minimum period of is p p p, that p ∣ r p|r p∣r( Otherwise you can use WPL Construct smaller cycles ). here p ∣ r ∣ d p|r|d p∣r∣d.
if p < d p<d p<d, because p p p yes S S S The cycle of , Therefore, a matching bit closer to the first matching bit can be found , And d d d The definition of contradiction

Therefore, it is only possible p = r = d p=r=d p=r=d, also d ∣ q d|q d∣q, So the matching bit is after processing T T T On , Every time d d d once , The matching position means that the tolerance is d d d The arithmetic sequence of .
1.3 1.3 1.3 character string s s s All not less than ∣ s ∣ 2 \frac{|s|}{2} 2∣s∣ Of border \text{border} border Form an arithmetic sequence
set up s s s maximal border \text{border} border by n − p ( p ≤ ∣ s ∣ 2 ) n-p(p\le \frac{|s|}{2}) n−p(p≤2∣s∣), the other one border \text{border} border by n − q ( q ≤ ∣ s ∣ 2 ) n-q(q\le \frac{|s|}{2}) n−q(q≤2∣s∣)
because p p p, q q q yes s s s The cycle of , therefore gcd ( p , q ) \gcd(p,q) gcd(p,q) yes s s s The cycle of
therefore n − gcd ( p , q ) n-\gcd(p,q) n−gcd(p,q) yes s s s Of border \text{border} border
therefore p ∣ q p|q p∣q
Again because p p p yes s s s The cycle of , therefore s s s Your appearance can be painted
so s s s All not less than ∣ s ∣ 2 \frac{|s|}{2} 2∣s∣ Of border \text{border} border Form an arithmetic sequence , The tolerance is p p p
1.4 1.4 1.4 inference : character string s s s All of the border \text{border} border It can be divided into O ( log ∣ s ∣ ) O(\log |s|) O(log∣s∣) paragraph , Each segment is an arithmetic sequence
take s s s Of border \text{border} border on length x x x Divide into log ∣ s ∣ \log|s| log∣s∣ class , remember 2 k 2^k 2k Is no more than n n n Of 2 2 2 Power of power
x ∈ [ 1 , 2 ) , [ 2 , 4 ) , . . . , [ 2 k − 1 , 2 k ) , [ 2 k , n ) x\in [1,2),[2,4),...,[2^{k-1},2^k),[2^k,n) x∈[1,2),[2,4),...,[2k−1,2k),[2k,n)
about x ∈ [ 2 k , n ) x\in [2^k,n) x∈[2k,n), obviously 2 k ≥ n 2 2^k\ge \frac{n}{2} 2k≥2n, Then this segment forms an arithmetic sequence
about x ∈ [ 2 i − 1 , 2 i ) x\in [2^{i-1},2^i) x∈[2i−1,2i), Consider a clever structure
Let's go straight to the map You should understand 233
The two tolerances are d1,d2 The tolerance should be lcm(d1,d2) Well
Then you can cut it off Mivik The title of the 了 .
边栏推荐
- 【MySQL】MySQL错误“ERROR 2006 (HY000):MySQL server has gone away”
- Skiasharp's WPF self drawn drag ball (case version)
- ThresholdFilter简介说明
- 总线相关概念集合
- On July 13, 2021, we collapsed like this
- 医药行业数字化建设,箭在弦上
- [OpenHarmony] [RK2206] 构建OpenHarmony编译器 (二)
- Database advanced learning notes -- storage functions
- SQL Server、MySQL主从搭建,EF Core读写分离代码实现
- JS提升:实现flat平铺的底层原理
猜你喜欢
Edge团队详解如何通过磁盘缓存压缩技术提升综合性能体验

3 minutes to tell you how to become a hacker | zero foundation to hacker getting started guide, you only need to master these five abilities

高温天气筑牢安全生产防线,广州海珠区开展加油站应急演练

In retaliation for the dismissal of the company, I changed all code comments of the project!
![[esp32][esp idf][lvgl7.9] failed to compile with OLED IIC](/img/16/e5aa43df6ef9bdbc173fa547c85559.png)
[esp32][esp idf][lvgl7.9] failed to compile with OLED IIC

为什么要考一级建造师,一建证书含金量有多高?

How to get more marks in the game under the new economic model of Plato farm

OSPF的拓展配置,选路原则,防环及重发布

我用小程序容器让移动研发效率提升了5倍!

JS promotion: the underlying principle of flat tiling
随机推荐
B2B2C系统亮点是什么?如何助力珠宝首饰企业打造全渠道多商户商城管理体系
Espresso systems, which has just obtained financing, has both intellectual property rights and team ethics in trouble
Description of landingsite electronic label quppa firmware entering DFU status
arthas使用教程
Plato Farm-以柏拉图为目标的农场元宇宙游戏
二维前缀和
超级原始人系列盲盒即将上线,PlatoFarm赋能超多权益
Deepin 下安装 LAMP
PHP7 中 ?? 与? :的区别
Tencent technical experts: decrypt the 100 million user products wechat, QQ, King glory... Comprehensively practice on the cloud!
能够遍历一个文件夹下的所有文件和子文件夹
我用小程序容器让移动研发效率提升了5倍!
【MySQL】Got an error reading communication packets
[ESP32][esp-idf] AP+STA实现无线桥接 中转wifi信号
一文读懂Plato Farm的ePLATO,以及其高溢价缘由
7.27 minimum spanning tree phased test problem solution
LandingSite电子标签Quuppa固件进入DFU状态说明
Edge team explains how to improve the comprehensive performance experience through disk cache compression technology
JWT login authentication + token automatic renewal scheme, well written!
建筑建材行业B2B电子商务网站方案:赋能建材企业转型升级,实现降本提效