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

重庆商城网站开发有关大学生做兼职的网站

重庆商城网站开发,有关大学生做兼职的网站,西安房产信息网官网,网站后台管理系统怎么进传送门 文章目录题意#xff1a;思路#xff1a;题意#xff1a; 思路#xff1a; 由kmpkmpkmp中失配数组nenene的含义我们知道#xff0c;ne[i],ne[ne[i]],...ne[i],ne[ne[i]],...ne[i],ne[ne[i]],...都是iii的相等的前后缀#xff0c;但是可能有重叠的部分#xff0c…传送门 文章目录题意思路题意 思路 由kmpkmpkmp中失配数组nenene的含义我们知道ne[i],ne[ne[i]],...ne[i],ne[ne[i]],...ne[i],ne[ne[i]],...都是iii的相等的前后缀但是可能有重叠的部分那么就有一个显然的做法对于每个iii不断向前跳记录ne[x]i/2ne[x]i/2ne[x]i/2的个数复杂度O(n2)O(n^2)O(n2)。 考虑优化我们记录一个数组cnt[i]cnt[i]cnt[i]表示可重叠的后缀个数这个显然可以通过求nenene的时候递推出来那么我们跳到ne[x]i/2ne[x]i/2ne[x]i/2的时候直接加上cnt[x]cnt[x]cnt[x]即可但是这样还是会被aaaaaaaaaaaaaaa这种的串串卡掉继续优化。 考虑利用之前的信息由于到了iii我们就暴跳到ne[x]i/2ne[x]i/2ne[x]i/2那么对于i1i1i1一定有ne[x](i1)/2ne[x](i1)/2ne[x](i1)/2满足要求复杂度O(n)O(n)O(n)。 当然还有一个无脑的做法就是倍增优化暴跳的方式复杂度O(tnlogn)O(tnlogn)O(tnlogn)能过也是奇迹不过还是需要一些卡常的比如将数组f[N][20]f[N][20]f[N][20]写成f[20][N]f[20][N]f[20][N]这样快了1s1s1s。 O(n)O(n)O(n) // Problem: P2375 [NOI2014] 动物园 // Contest: Luogu // URL: https://www.luogu.com.cn/problem/P2375 // Memory Limit: 512 MB // Time Limit: 1000 ms // // Powered by CP Editor (https://cpeditor.org)//#pragma GCC optimize(Ofast,no-stack-protector,unroll-loops,fast-math) //#pragma GCC target(sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tunenative) //#pragma GCC optimize(2) #includecstdio #includeiostream #includestring #includecstring #includemap #includecmath #includecctype #includevector #includeset #includequeue #includealgorithm #includesstream #includectime #includecstdlib #includerandom #includecassert #define X first #define Y second #define L (u1) #define R (u1|1) #define pb push_back #define mk make_pair #define Mid ((tr[u].ltr[u].r)1) #define Len(u) (tr[u].r-tr[u].l1) #define random(a,b) ((a)rand()%((b)-(a)1)) #define db puts(---) using namespace std;//void rd_cre() { freopen(d://dp//data.txt,w,stdout); srand(time(NULL)); } //void rd_ac() { freopen(d://dp//data.txt,r,stdin); freopen(d://dp//AC.txt,w,stdout); } //void rd_wa() { freopen(d://dp//data.txt,r,stdin); freopen(d://dp//WA.txt,w,stdout); }typedef long long LL; typedef unsigned long long ULL; typedef pairint,int PII;const int N1000010,mod1e97,INF0x3f3f3f3f; const double eps1e-6;int n; char s[N]; int ne[N],pre[N];inline int read(){char chgetchar(); int x0,w1;while(ch0||ch9) {if(ch-) w-1; chgetchar();}while(ch0ch9) {x(x3)(x1)(ch^48); chgetchar();}return x*w; }int main() { // ios::sync_with_stdio(false); // cin.tie(0);int _; _read();while(_--) {scanf(%s,s1);nstrlen(s1);pre[1]1;for(int i2;in;i) {int jne[i-1];while(js[i]!s[j1]) jne[j];if(s[i]s[j1]) j;ne[i]j; pre[i]pre[j]1;}LL ans1;for(int i2,j0;in;i) {while(js[i]!s[j1]) jne[j];if(s[i]s[j1]) j;while(ji/2) jne[j];ans*pre[j]1; ans%mod;}printf(%lld\n,ans);}return 0; } /* abababab */ O(tnlogn)O(tnlogn)O(tnlogn) // Problem: P2375 [NOI2014] 动物园 // Contest: Luogu // URL: https://www.luogu.com.cn/problem/P2375 // Memory Limit: 512 MB // Time Limit: 1000 ms // // Powered by CP Editor (https://cpeditor.org)//#pragma GCC optimize(Ofast,no-stack-protector,unroll-loops,fast-math) //#pragma GCC target(sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tunenative) //#pragma GCC optimize(2) #includecstdio #includeiostream #includestring #includecstring #includemap #includecmath #includecctype #includevector #includeset #includequeue #includealgorithm #includesstream #includectime #includecstdlib #includerandom #includecassert #define X first #define Y second #define L (u1) #define R (u1|1) #define pb push_back #define mk make_pair #define Mid ((tr[u].ltr[u].r)1) #define Len(u) (tr[u].r-tr[u].l1) #define random(a,b) ((a)rand()%((b)-(a)1)) #define db puts(---) using namespace std;//void rd_cre() { freopen(d://dp//data.txt,w,stdout); srand(time(NULL)); } //void rd_ac() { freopen(d://dp//data.txt,r,stdin); freopen(d://dp//AC.txt,w,stdout); } //void rd_wa() { freopen(d://dp//data.txt,r,stdin); freopen(d://dp//WA.txt,w,stdout); }typedef long long LL; typedef unsigned long long ULL; typedef pairint,int PII;const int N1000010,mod1e97,INF0x3f3f3f3f; const double eps1e-6;int n; char s[N]; int ne[N]; int f[21][N];int main() { // ios::sync_with_stdio(false); // cin.tie(0);int _; scanf(%d,_);while(_--) {scanf(%s,s1);nstrlen(s1);for(int i2,j0;in;i) {while(js[i]!s[j1]) jne[j];if(s[i]s[j1]) j;ne[i]j; f[0][i]ne[i];}for(int k1;k19;k) for(int i1;in;i) f[k][i]f[k-1][f[k-1][i]];int ans1;for(int i2;in;i) {int now0,xi;for(int j19;j0;j--) if(f[j][x]*2i) xf[j][x];for(int j19;j0;j--) if(f[j][x]) now1j,xf[j][x];ans1ll*ans*(now1)%mod;}printf(%d\n,ans);}return 0; } /**/
http://www.yutouwan.com/news/183263/

相关文章:

  • 做类似淘宝网站多少钱营销型网站设计方针
  • 在线crm网站国际新闻大事
  • 定制网站建设公司电话vitality 中文原创wordpress主题
  • 深圳网站建设外贸公司排名u盘搭建网站开发环境方法
  • sql网站模板一对一视频直播app开发
  • 收录好的博客网站吗企业网站建设定制开发
  • 做个手机网站有必要吗中小学网站建设建议
  • 任房保障和城乡建设局网站深圳网站制作企业邮箱
  • 网站开发学习什么最好看的2018中文在线观看
  • 网站发送邮件功能ps制作个性字网站
  • xd软件可做网站吗游戏租号网站开发
  • 展示网站源码下载校园淘宝店网站开发
  • 建网站报价新站seo优化快速上排名
  • 建设网站免费模板做个门户网站多少钱
  • 国外刺绣图案设计网站wordpress 生成pdf
  • 如何提升网站alexa排名王野天和葛优
  • 做个营销型网站wordpress标签管理系统
  • 广东网站设计程序员免费自学网站
  • 深圳家居网站建设公司新乡网站开发的公司电话
  • 苏州网站建设 江苏千渡php网站分类目录源码
  • 专门做门业的网站万网企业网站建设
  • 什么是网页站点工程承包平台
  • 网站标题特效昆明网站搜索优化
  • 网站建设策划书封面wordpress仪表盘修改
  • 做购物车的网站学校网站开发与设计
  • 珠海网站建站模板济南全网关键词排名公司
  • angular2做的网站有网站收录入口
  • 中国科技发展成果网站优化内容有哪些
  • 网站制作交易流程安徽工程建设信息网新网站
  • 网站开发详细流程图wordpress豆瓣电影图书分享插件