• 2024-08-29Manacher 马拉车
    Manacher马拉车,一种为了求字符串中最长的回文字串的算法。这个算法是从暴力的方法转化过来的,暴力肯定是枚举字符串每个字符作为中心,然后向外扩展,这样的复杂度为\(O(n^2)\)。而Manacher则是按照回文对称的性质的进行优化的,首先回文串有奇数串\(aba\)和偶数串\(abba\)如果
  • 2024-04-17马拉车Mananer(求最长回文子序列)
    直接上板子直接输出最长回文子序列的长度#include<bits/stdc++.h>#defineintlonglong#defineIOSios::sync_with_stdio(0);cin.tie(0);cout.tie(0);usingnamespacestd;chars[32000005],st[32000005];intp[32000005];intchange(){intlen=strlen(st);
  • 2024-04-09Codeforces Global Round 25 E
    链接其实还是很好写的。其实很明显,手玩一下就可以发现只用1次或者两次就可以分完,否则就是以下3中情况。aaaaaaaaabaaaabababa这个证明很简单。难在怎么想。其实就是手玩以下,看看怎么样分不了,然后就可以了。样例具有一定的迷惑性,还是很好解决的。然后马拉车数组清空要清到
  • 2024-03-22马拉车板子
    #include<bits/stdc++.h>#defineintlonglongusingnamespacestd;std::vector<int>manacher(std::strings){std::stringt="#";for(autoc:s){t+=c;t+='#';}cout<<t<<
  • 2024-03-14马拉车算法
    LuoguP3805【模板】manacher算法1//LuoguP3805【模板】manacher算法2#include<iostream>3#include<cstring>4#include<algorithm>5usingnamespacestd;67constintN=3e7;8chara[N],s[N];9intd[N];//回文半径函数1011voidget_
  • 2024-02-022.2(出校前)
    比赛进行中,但是马上出校了,火车怕赶不上,年前的集训到此结束了。题目过于抽象,不会~隔壁\(shadow\)已经去拉车了……爱怎么着怎么着吧,比赛结束之前就得走。等到家估计很晚了,到时候再系统打一篇集训心得。这次模拟赛要是有时间写一下题解,估计写不出来……有什么之情博客发邮件
  • 2024-01-22高铁拉我,马拉车——记高铁路上的manacher
    目录前言问题引入思路一览manacher高效的原因具体情况讨论小问题的讨论code前言不得为什么,总会在奇奇怪怪的时候特定时间看算法比平常看得舒服多了,之前看字符串匹配的时候自然是准备把马拉车一起看了的,但是那时候看不下去,昨天回家的高铁上再次看了看,觉得格外的亲切,emmm问题引入
  • 2024-01-20马拉车算法
    马拉车算法chars[maxn],ss[maxn];intp[maxn];intlen,center;intcnt=1;voidinit(){memset(s,0,sizeofs);cnt=1,s[0]='@';intlen=strlen(ss);for(inti=0;i<len;i++){s[cnt++]='#';s[cnt++]=ss
  • 2023-07-01manacher马拉车算法
    目录manacher算法相关资料manacher算法用于\(O(n)\)求解字符串中的最长回文子串相关资料马拉车算法(不懂问我)
  • 2023-06-13马拉车算法
    截图来自董老师https://www.bilibili.com/video/BV173411V7Ai/?spm_id_from=333.999.0.0&vd_source=23dc8e19d485a6ac47f03f6520fb15c2  P3805【模板】manacher算法#include<iostream>#include<cstring>#include<cmath>#include<algorithm>#include
  • 2022-11-16Manacher(马拉车)
    Manacher算法:最长回文串(以每个点为中心的回文串长度)直接上代码MY_Code://22.10.8Manacher顶级理解#include<bits/stdc++.h>usingnamespacestd;constintN=4e7;
  • 2022-10-14主说,马要拉车,于是马就学会了拉车。
    \(\operatorname{Manacher}\)算法大体来讲并不难,使用它可以在线性时间内求出某字符串中最大回文子串的长度。基础首先我们知道一个回文串的长度可以是奇数(存在回文中心),
  • 2022-09-26马拉车
    #include<bits/stdc++.h>usingnamespacestd;strings,ss;intp[100100];intmain(){cin>>s;ss+="*#";intlen=s.length();for(inti=