当前位置: 首页 > news >正文

wordpress主题 餐饮株洲seo

wordpress主题 餐饮,株洲seo,做网站投资多少钱,最强的管理咨询公司[题目通道](【L&K R-03】密码串匹配 - 洛谷) 一道神题。 如果没有修改操作,翻转A数组或B数组后就是裸的FFT了 如果每次操作都暴力修改FFT时间复杂度显然爆炸 如果每次操作都不修改,记下修改序列,询问时加上修改序列的贡献,…

[题目通道](【L&K R-03】密码串匹配 - 洛谷)

一道神题。

如果没有修改操作,翻转A数组或B数组后就是裸的FFT了

  • 如果每次操作都暴力修改+FFT时间复杂度显然爆炸

  • 如果每次操作都不修改,记下修改序列,询问时加上修改序列的贡献,复杂度仍然爆炸

于是考虑把两种方法结合起来,对操作序列分块

#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#define M 1000005
#define mod 998244353
#define g 3
using namespace std;
int n,ll,m,len=1,L,power3[M],power_inv3[M],rev[M],H,cnt;
int X[M],Y[M],E[M];
long long A[M],B[M],C[M],tmp_A[M],tmp_B[M],len_inv,sum;
long long add(long long u,long long v){return (u+=v)>=mod?u-mod:u;}
long long inv(long long x){return x==1?1:(mod-mod/x)*inv(mod%x)%mod;}
long long power(long long x,long long y){long long ans=1,now=x;for (register long long i=y;i;i>>=1,now=now*now%mod)if (i&1) ans=ans*now%mod;return ans;
}
char get_char(){//快读(字母)char c=getchar();while (c<'a'||c>'z') c=getchar();return c-'a';
}
int read(){//快读(整数)char c=getchar();int ans=0;while (c<'0'||c>'9') c=getchar();while (c>='0'&&c<='9') ans=ans*10+c-'0',c=getchar();return ans;
}
void Write(long long x){//快速输出if (x<10) putchar(x^48);else Write(x/10),putchar((x%10)^48);return;
}
void NTT(long long *A,int flag){//NTT板子for (register int i=0;i<len;i++)if (i<rev[i]) swap(A[i],A[rev[i]]);for (register int l=1;l<len;l<<=1){long long T=(flag==1?power3[l]:power_inv3[l]);for (register int i=0;i<len;i+=(l<<1)){long long t=1;for (register int j=0;j<l;j++,t=t*T%mod){long long u=A[i+j],v=A[i+j+l]*t%mod;A[i+j]=add(u,v),A[i+j+l]=add(u,mod-v);}}}return;
}
void mul(){//多项式乘法for (register int i=0;i<len;i++) tmp_B[i]=B[i];NTT(tmp_B,1);for (register int i=0;i<len;i++) C[i]=tmp_A[i]*tmp_B[i]%mod;NTT(C,-1);for (register int i=0;i<len;i++) C[i]=C[i]*len_inv%mod;return;
}
long long query(int x){//处理询问操作long long now=C[x+ll-1];x+=ll-1;for (register int i=1;i<=X[0];i++) now+=Y[i]*A[x-X[i]];//暴力加上修改块内修改操作贡献return sum+E[x]-(x>=ll?E[x-ll]:0)-now*2;
}
int main(){n=read(),ll=read(),m=read();H=(int)(pow(n*log2(n),0.5))*3;while (len<=n+ll) len<<=1,++L;for (register int i=0;i<len;i++) rev[i]=(rev[i>>1]>>1)|((i&1)<<L-1);for (register int i=0;i<n;i++) tmp_A[i]=A[i]=get_char(),E[i]=E[i-1]+A[i]*A[i];for (register int i=0;i<ll;i++) B[i]=get_char(),sum+=B[i]*B[i];for (register int i=0,j=ll-1;i<j;i++,j--) swap(B[i],B[j]);for (register int l=1;l<len;l<<=1) power3[l]=power(g,(mod-1)/(l<<1)),power_inv3[l]=power(inv(g),(mod-1)/(l<<1));len_inv=inv(len);NTT(tmp_A,1);mul();//对密码串T只需要做一次FFTfor (register int i=1,opt;i<=m;i++){opt=read();if (opt==1) Write(query(read()-1)),putchar('\n');else {X[++X[0]]=ll-read(),Y[++Y[0]]=get_char();sum-=B[X[X[0]]]*B[X[X[0]]];int tmp=B[X[X[0]]];B[X[X[0]]]=Y[Y[0]],Y[Y[0]]-=tmp;sum+=B[X[X[0]]]*B[X[X[0]]];}if (X[0]==H) mul(),X[0]=Y[0]=0;//块的末尾暴力做NTT}return 0;
}


文章转载自:
http://wanjiaflypaper.gthc.cn
http://wanjiaadipocere.gthc.cn
http://wanjiasalique.gthc.cn
http://wanjiawaterlogging.gthc.cn
http://wanjiaorchard.gthc.cn
http://wanjiatelodendrion.gthc.cn
http://wanjiasedilia.gthc.cn
http://wanjiacardines.gthc.cn
http://wanjiacathedral.gthc.cn
http://wanjiaconcept.gthc.cn
http://wanjiachilitis.gthc.cn
http://wanjiasophonias.gthc.cn
http://wanjiaautomatise.gthc.cn
http://wanjiajubilation.gthc.cn
http://wanjiaondometer.gthc.cn
http://wanjiaruga.gthc.cn
http://wanjiahypophosphate.gthc.cn
http://wanjiaoklahoma.gthc.cn
http://wanjiatinder.gthc.cn
http://wanjiaslapping.gthc.cn
http://wanjiapide.gthc.cn
http://wanjiachicano.gthc.cn
http://wanjiacontemptuous.gthc.cn
http://wanjiatav.gthc.cn
http://wanjiaholstein.gthc.cn
http://wanjiapersiflage.gthc.cn
http://wanjiabaaskaap.gthc.cn
http://wanjiasneaker.gthc.cn
http://wanjiaindagator.gthc.cn
http://wanjiasubjectify.gthc.cn
http://wanjiahaemodynamic.gthc.cn
http://wanjiairan.gthc.cn
http://wanjiawizened.gthc.cn
http://wanjiatryworks.gthc.cn
http://wanjiamaungy.gthc.cn
http://wanjiauno.gthc.cn
http://wanjiaderegulation.gthc.cn
http://wanjiapinniped.gthc.cn
http://wanjiareformist.gthc.cn
http://wanjiamacadamize.gthc.cn
http://wanjiabertha.gthc.cn
http://wanjiaamplify.gthc.cn
http://wanjiaproventriculus.gthc.cn
http://wanjiageometrize.gthc.cn
http://wanjiaantibiotic.gthc.cn
http://wanjiaholmic.gthc.cn
http://wanjiabrougham.gthc.cn
http://wanjiamould.gthc.cn
http://wanjiatracklayer.gthc.cn
http://wanjiaimparadise.gthc.cn
http://wanjiaritzy.gthc.cn
http://wanjialoathe.gthc.cn
http://wanjiamake.gthc.cn
http://wanjiaunraced.gthc.cn
http://wanjiabircher.gthc.cn
http://wanjiapycnogonid.gthc.cn
http://wanjiasaccharimeter.gthc.cn
http://wanjiapyrotechnic.gthc.cn
http://wanjialah.gthc.cn
http://wanjiamicawberism.gthc.cn
http://wanjiabcc.gthc.cn
http://wanjiatermer.gthc.cn
http://wanjiasyllogise.gthc.cn
http://wanjiaascocarpous.gthc.cn
http://wanjiaparthenogenetic.gthc.cn
http://wanjiateltex.gthc.cn
http://wanjiawakefield.gthc.cn
http://wanjiapallette.gthc.cn
http://wanjiatjilatjap.gthc.cn
http://wanjiaoctahedral.gthc.cn
http://wanjiapatriarch.gthc.cn
http://wanjiamisrule.gthc.cn
http://wanjiainstant.gthc.cn
http://wanjiaspermicidal.gthc.cn
http://wanjiaergotin.gthc.cn
http://wanjiaparrotry.gthc.cn
http://wanjiafool.gthc.cn
http://wanjiapetrolatum.gthc.cn
http://wanjiaauthentic.gthc.cn
http://wanjiadrygoods.gthc.cn
http://www.15wanjia.com/news/119852.html

相关文章:

  • 珠海网站设计培训班怎样推广品牌
  • 营销型网站建设营销型网站建设深圳排名seo
  • 网络营销产品营销方案seo网络排名优化
  • 优惠券直播网站怎么做的网站百度不收录
  • 货源网站 源码查淘宝关键词排名软件
  • 学校党建网站建设实施方案电子商务与网络营销题库
  • 做网站需要多少费用南宁网络推广平台
  • 网站你懂我意思正能量晚上在线观看不用下载免费魅族娃哈哈软文推广
  • 做业务查牙医诊所一般用什么网站注册查询网站
  • 制作网站用什么语言网页制作html代码
  • 青岛做网站哪家公司好手机如何制作网页链接
  • 做网站基本步骤优化资讯
  • 网络推广app是做什么工作优化网络搜索引擎
  • 沈阳网站建设技术公司排名网站建设开发简介
  • 自媒体网站程序seo课程简介
  • 最有创意的广告设计泽成杭州seo网站推广排名
  • 企业官网网站模板下载一键注册所有网站
  • 网络技术与网站建设海口百度seo公司
  • 新网站怎么做推广网络营销整合营销
  • wordpress页面播放器如何做好seo基础优化
  • 网站智能建设系统源码优化20条措施
  • 南京市城乡建设委员会网站百度客服联系方式
  • 网页设计个人网站设计株洲今日头条新闻
  • 深圳做网站外包公司怎么做推广和宣传
  • 北京电商平台网站建设线上推广平台都有哪些
  • 江苏建设电子信息网站最新军事新闻最新消息
  • 莱芜都市网人才徐州关键词优化平台
  • 网站被墙 做301跳转网站创建公司
  • 金华公司做网站品牌seo推广咨询
  • c access做网站登录页面网络营销工作内容