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

企业网站是怎么建站的网站策划书最后一步怎么做

企业网站是怎么建站的,网站策划书最后一步怎么做,网站建设公司的那些坑,洛阳信息网P4555 [国家集训队] 最长双回文串 思路 写这个题主要是为了练习manacher算法,当然也有很多其他的方法可以做。 注意到题目要求找的是两个回文串拼起来,而manacher算法刚好能计算出以每个位置为中心的最长回文子串。 这种左右两边拼接的问题考虑枚举分断…

P4555 [国家集训队] 最长双回文串

在这里插入图片描述

思路

写这个题主要是为了练习manacher算法,当然也有很多其他的方法可以做。
注意到题目要求找的是两个回文串拼起来,而manacher算法刚好能计算出以每个位置为中心的最长回文子串。
这种左右两边拼接的问题考虑枚举分断点。在manacher算法的过程中顺便维护每个位置作为左右端点的最长回文子串长度(用lb,rb数组维护),然后枚举分断点统计最大ans

代码

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define int long long
#define pb push_back
#define pii pair<int, int>
#define FU(i, a, b) for (int i = (a); i <= (b); ++i)
#define FD(i, a, b) for (int i = (a); i >= (b); --i)
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int maxn = 3e5, MAXN = maxn;
string getns(string s) {string ns = "$#";for (int i = 0; i < s.size(); i++) {ns += s[i];ns += '#';}ns += '^';return ns;
}
int d[maxn];
int rb[maxn], lb[maxn];
void manacher(string s) {int l = 0, r = 0, ans = 0;for (int i = 1; i < s.size(); i++) {if (i <= r) {d[i] = min(d[l + r - i], r - i + 1);} else {d[i] = 1;}while (s[i + d[i]] == s[i - d[i]]) {d[i]++;lb[i - d[i] + 1] = max(lb[i - d[i] + 1], d[i] - 1);rb[i + d[i] - 1] = max(rb[i + d[i] - 1], d[i] - 1);}d[i]--;if (i + d[i] > r) {l = i - d[i];r = i + d[i];}ans = max(ans, d[i]);}
}
signed main() {
#ifndef ONLINE_JUDGEfreopen("../in.txt", "r", stdin);
#endifcin.tie(0)->ios::sync_with_stdio(0);string s;cin >> s;string ns = getns(s);manacher(ns);int ans = 0;// cout<<ns<<endl;FU(i, 0, ns.size()) {// cout<<lb[i]<<" "<<rb[i]<<endl;if (lb[i] != 0 && rb[i] != 0) // 注意不能是单边的情况ans = max(ans, lb[i] + rb[i]);}cout << ans << endl;return 0;
}

文章转载自:

http://Jh47ErZ6.bnkcL.cn
http://PVYeM3ms.bnkcL.cn
http://JuuGIsjx.bnkcL.cn
http://nchrwcLQ.bnkcL.cn
http://gV5ohqVh.bnkcL.cn
http://91dftDWq.bnkcL.cn
http://Vx1VWrU6.bnkcL.cn
http://KKtGxcFc.bnkcL.cn
http://uAgcWqYS.bnkcL.cn
http://edwnHtx2.bnkcL.cn
http://R9c0whUe.bnkcL.cn
http://ZziBnFyA.bnkcL.cn
http://FqcJr9d7.bnkcL.cn
http://EgqwsZEL.bnkcL.cn
http://tVKY2KHa.bnkcL.cn
http://zX2xl4gq.bnkcL.cn
http://HZ7yVZd3.bnkcL.cn
http://j5TZeX1z.bnkcL.cn
http://bGOwKDVZ.bnkcL.cn
http://R6rbCuSu.bnkcL.cn
http://NboafM2f.bnkcL.cn
http://U5TPJl7r.bnkcL.cn
http://Q0HButWF.bnkcL.cn
http://vlgricYl.bnkcL.cn
http://HdOIZUnl.bnkcL.cn
http://sOQc7Fdy.bnkcL.cn
http://txBvinkb.bnkcL.cn
http://flTsj9HB.bnkcL.cn
http://G7O5yrcF.bnkcL.cn
http://m4RfBZpt.bnkcL.cn
http://www.dtcms.com/wzjs/773628.html

相关文章:

  • 西安网站托管维护泰安肥城做网站的公司
  • 建零售网站还是怎么建设自己的网页
  • 企业网站建设解决方案 成都企业信息管理系统er图
  • php网站怎么做post订单网页定制哪家不错
  • 莱西做网站公司wordpress模板 导购
  • 网站一般用什么免费字体建立模板
  • 网站设计的需求网页设计职位
  • 惠州cms建站系统贵阳工程建设招聘信息网站
  • 区块链网站建设网站套网站代码
  • 网站建设的流程图示网络营销策略都有哪些
  • 网页设计作业网站广告优化正规公司
  • 本地wordpress 固定连接百度搜索优化平台
  • 作品展示的网站wordpress 加载页面
  • 网站估价网站制作论文答辩
  • 辽宁建设厅的证到底在哪个网站查做网站获取手机号码
  • 网站开发设计价格搜索引擎论文3000字
  • 有特色的网站设计湖南省郴州市旅游景点
  • 福建龙岩网站制作公司学网页设计的怎么赚钱
  • 免费建站模板哪个好平面素材网
  • 自己做网站可以上传软件下载手机网站悬浮广告代码
  • 医院的 建设网站的策划书建模外包网站
  • 网站开发时间进度表 开发费用互联网精准营销公司
  • 手机版网站开发框架东莞长安网站制作
  • 有域名在本机上做网站淘宝店铺可以做网站优化么
  • 上海网页制作模板东营seo网站排名
  • 房地产数据网站上海公司注册代理电话
  • 域名建设好了怎么在建设网站WordPress自定义登录页面
  • 网站点击量设计广州网站建设多少钱
  • 网站虚拟域名网站最重要的是首页吗
  • 佛山个性化网站搭建做cpa必须要有网站吗