bzoj3676 回文串 回文树

回文树(模板)+ 例题 引用: Palindromic Tree——回文树【处理一类回文串问题的强力工具】 回文树练习题集 首先,回文树有何功能? 假设我们有一个串S,S下标从0开始,则回文树能做到如下几点: 1.求串S前缀0~i内本质不同回文串的个数(两个串长度不同或者长度相同且至少有一个字符不同便是本质不同) 2.求串S内每一个本质不同回文串出现的次数 3.求串S内回文串的个数(其实就是1和2结合起来)... 阅读详情

题目:

考虑一个只包含小写拉丁字母的字符串s。我们定义s的一个子串t的“出 
现值”为t在s中的出现次数乘以t的长度。请你求出s的所有回文子串中的最 
大出现值。 

Input

输入只有一行,为一个只包含小写字母(a -z)的非空字符串s。 

Output


输出一个整数,为逝查回文子串的最大出现值。 

Sample Input
【样例输入l】 
abacaba 

【样例输入2] 
www 

Sample Output
【样例输出l】 
7 

【样例输出2] 
4 
Hint



一个串是回文的,当且仅当它从左到右读和从右到左读完全一样。 

在第一个样例中,回文子串有7个:a,b,c,aba,aca,bacab,abacaba,其中: 

● a出现4次,其出现值为4:1:1=4 

● b出现2次,其出现值为2:1:1=2 

● c出现1次,其出现值为l:1:l=l 

● aba出现2次,其出现值为2:1:3=6 

● aca出现1次,其出现值为1=1:3=3 

●bacab出现1次,其出现值为1:1:5=5 

● abacaba出现1次,其出现值为1:1:7=7 

故最大回文子串出现值为7。 

【数据规模与评分】 

数据满足1≤字符串长度≤300000。


思路:套模板

代码:

#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<iostream>
#include<algorithm>
#include<ctime>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<numeric>
using namespace std;
#define LL long long
#define ULL unsigned long long
#define INF 0x3f3f3f3f3f3f3f3f
#define mm(a,b) memset(a,b,sizeof(a))
#define PP puts("*********************");
template<class T> T f_abs(T a){ return a > 0 ? a : -a; }
template<class T> T gcd(T a, T b){ return b ? gcd(b, a%b) : a; }
template<class T> T lcm(T a,T b){return a/gcd(a,b)*b;}
// 0x3f3f3f3f3f3f3f3f

const int MAXN = 3e5+50, SIZE = 26;
struct Palindromic_Tree {
	int next[MAXN][SIZE];//next指针
	int fail[MAXN];//fail指针
	int cnt[MAXN];//表示节点i表示的回文串的个数(建树时求出的不是完全的,最后Count()函数跑一遍以后才是正确的)
	int num[MAXN];//表示以节点i表示的最长回文串的最右端点为回文串结尾的回文串个数
	int len[MAXN];//len[i]表示节点i表示的回文串的长度(一个节点表示一个回文串)
	int S[MAXN];//存放添加的字符
	int last;//指向上一个字符所在的节点,方便下一次add
	int n;//字符数组指针
	int p;//节点指针
	int NewNode(int L) {//新建节点
		for(int i = 0; i < SIZE; ++i)
			next[p][i] = 0;
		cnt[p] = num[p] = 0;
		len[p] = L;
		return p++;
	}
	void Init() {//初始化
		p = n = 0;
		NewNode(0); NewNode(-1);
		last = 0;
		S[n] = -1;//开头放一个字符集中没有的字符,减少特判
		fail[0] = 1;
	}
	int GetFail(int x) {//和KMP一样,失配后找一个尽量最长的
		while(S[n - len[x] - 1] != S[n]) x = fail[x];
		return x;
	}
	void Add(int c) {
		S[++n] = c;
		int cur = GetFail(last);//通过上一个回文串找这个回文串的匹配位置
		if(!next[cur][c]) {//如果这个回文串没有出现过,说明出现了一个新的本质不同的回文串
			int now = NewNode(len[cur] + 2);//新建节点
			fail[now] = next[GetFail(fail[cur])][c];//和AC自动机一样建立fail指针,以便失配后跳转
			next[cur][c] = now;
			num[now] = num[fail[now]] + 1;
		}
		last = next[cur][c];
		cnt[last]++;
	}
	void Count() {
		for(int i = p - 1; i >= 0; --i)
			cnt[fail[i]] += cnt[i];
		//父亲累加儿子的cnt,因为如果fail[v]=u,则u一定是v的子回文串!
	}
}tree;
char str[MAXN];
int main(){

    scanf("%s",str);
    tree.Init();
    for(int i=0;str[i]!='\0';i++)
        tree.Add(str[i]-'a');
    tree.Count();
    LL ans=1;
    for(int i=0;i<tree.p;i++)
        ans=max(ans,(LL)tree.cnt[i]*tree.len[i]);
    printf("%lld\n",ans);
    return 0;
}


ROS TF坐标转换实战:从零搭建机器人坐标系(附常见问题排查) 本文提供了一份ROS TF坐标转换的实战指南,详细讲解了如何从零为机器人搭建完整的坐标系,并深入解析了TF的原理。内容涵盖静态与动态坐标变换的发布、URDF模型使用、以及Rviz和rqt_tf_tree等可视化调试工具。文章还附带了常见问题排查表,帮助开发者快速定位并解决TF树断裂、数据错位等典型问题。 阅读详情

相关推荐

在MacBook M1/M2上,手把手教你打包包含嵌入模型的RagFlow Docker镜像(避坑指南)

本文详细指导如何在MacBook M1/M2上构建ARM64架构的RagFlow Docker镜像,涵盖环境准备、依赖处理、镜像构建及性能优化全流程。特别针对Apple Silicon芯片的兼容性问题提供解决方案,帮助开发者高效完成本地开发环境搭建。

weixin_26908317的博客 241

bzoj 5365 [Lydsy1805月赛]回文树

http://www.elijahqi.win/archives/3521 虽然lct不能维护hash是错的 但是我们的AK王icefox巨佬依然可以AK 这就是具有神犇体质的人 因为自己没写过直接贴大爷的代码了 get一个技能判断回文可以用正向hash和逆向hash判断 是否相同即可确定是否回文 https://blog.youkuaiyun.com/icefox_zhx/article/deta...

Elijahqi 515

迭代牛顿-欧拉法——机器人动力学逆解

迭代牛顿-欧拉法牛顿欧拉法的步骤向外回归(outward recursion)step 1step 2向内回归(inward recursion)step 3step 4牛顿欧拉法的三种形式无坐标系NE算法(Coordinate-Free Algorithm)连杆坐标系NE算法(Link-Coordinates Algorithm)3-D向量NE算法 牛顿欧拉法的步骤 牛顿欧拉法(NE)是求解机器人动力学逆解的一种方法。动力学逆解定义为:已知机器人的构型qqq和运动的速度q˙\dot{q}q˙​和加速度q¨

qq_41845878的博客 4096

【BZOJ 2084 [Poi2010]Antisymmetry 回文树

回文树写法 #include #include #include #define LL long long #define maxn 500021 using namespace std; int n,len[maxn],fail[maxn],ch[maxn][26]; int N,cnt[maxn],s[maxn],last,p; char ss[maxn]; LL ans; int get(

pbihao的博客 498

vit的cam和注意力图: VIT模型的可解释性

VIT的热力图怎么画

YI_SHU_JIA的博客 1万+

解密电商大促背后的智慧:LSTM与ARIMA模型的双剑合璧

举个例子,如果某东发现某款新推出的电子产品在促销前夕搜索量突然暴涨,虽然这个产品没有过去的销售记录,但LSTM模型可以结合用户对类似产品的行为模式、实时的市场反馈,迅速捕捉到这些变化,并预测这款产品在大促期间的需求会急剧上升。想象一下,如果预测不准确,备货不足,商品很快就卖光了,大量用户可能在促销期间买不到想要的商品,这不仅让用户失望,还会影响某东的品牌形象。这种情况就像我们看一部很长的电视剧,看得越久,前面的情节可能就越来越模糊,到最后有些关键的情节细节都忘了,影响了对整个剧情的理解。

小蒋聊技术 2090

bzoj 2342: [Shoi2011]双倍回文 回文树

题意 给一个字符串S,求S一个最长的子串T满足T的长度是4的倍数,T是回文串且T的前半部分也是回文串。 |S|&lt;=500000 分析 先建出回文树,注意到T必然是回文树上的一个节点,且T的后半部分必然是该节点fauk树上的祖先。 那么我们就在fail树上遍历,同时记录搜索栈中每种长度的出现次数即可。 代码 #include&lt;iostream&gt; #incl...

beginend 279

【Python开发者必看】Windows下Python版本管理器Pyenv安装使用,轻松管理Python版本的入门与进阶指南,从此告别Python环境不兼容的噩梦

好了,关于 【Python开发者必看】Windows下Python版本管理器Pyenv安装使用,轻松管理Python版本的入门与进阶指南,从此告别Python环境不兼容的噩梦 就写到这儿了,如果还有什么疑问或遇到什么问题欢迎扫码提问,也可以给我留言哦,我会一一详细的解答的。1、手动下载对应版本到 pyenv-win\install_cache 目录(如上手动操作安装步骤,文件名需匹配,如 python-3.10.0-amd64.exe)。该指令会列出,pyenv包管理工具所支持的所有python版本,

Spring Boot-Common On With You 851

bzoj2160: 拉拉队排练

如果去看这一题的提交状况,P

elevendivide 1105

华为od 面试手撕代码题【完成任务最少小时】

华为od 面试手撕代码题【完成任务最少小时】

MISAYAONE的博客 1574

韩版传奇 2 源码分析与 Unity 重制(一)服务端 TCP 状态管理

该专题将会分析 LOMCN 基于韩版传奇 2,使用 .NET 重写的传奇源码(服务端 + 客户端),分析数据交互、状态管理和客户端渲染等技术,此外笔者还会分享将客户端部分移植到 Unity 和服务端用现代编程语言重写的全过程。本文重点介绍了服务端的启动链路、网络初始化和连接处理这三个过程,并简要分析的游戏循环的实现与数据包处理,在下一篇文章中,我们会从客户端角度分析从游戏启动、登录、游戏开始和基础游戏交互的全流程。

东方猫的博客 2496

回文树模板(区间查询回文串数量)

题目描述 You've got a strings=s_{1}s_{2}...\ s_{|s|}s=s1​s2​...s∣s∣​of length|s|∣s∣, consisting of lowercase English letters. There also areqqqueries, each query is described by two integersl_{i}...

AIRBOYONE的博客 887

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

回文树(回文自动机) - BZOJ 3676 回文串

  BZOJ 3676 回文串 Problem's Link:  http://www.lydsy.com/JudgeOnline/problem.php?id=3676   Mean:  略 analyse: 由于构造完回文自动机后,len[i]表示第i个回文串的长度,cnt[i]表示第i个回文串出现的次数,只需两者相...

weixin_33816300的博客 162

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

BZOJ 3676 回文串(回文树)题解

题意: 一个回文的价值为长度 * 出现次数,问一个串中的子串的最大回文价值 思路: 回文树模板题,跑PAM,然后计算所有节点出现次数。 参考: 回文串问题的克星——Palindrome Tree(回文树) 代码: #include<map> #include<set> #include<cmath> #include<cstdio> #in...

weixin_30412577的博客 153

BZOJ 3676: [Apio2014] 回文串 回文树 模版题

#include <bits/stdc++.h> #define ll long long using namespace std; const int maxn = 300005; struct PAM{//回文树 int next[maxn][26],fail[maxn],len[maxn],cnt[maxn],S[maxn]; // 一个结点一个本质不同...

恒持此志成永志 231

3676: [Apio2014]回文串 【BZOJ 3637】【回文树板子】

题目链接 考虑一个只包含小写拉丁字母的字符串s。我们定义s的一个子串t的“出现值”为t在s中的出现次数乘以t的长度。请你求出s的所有回文子串中的最大出现值。 解题思路 题目还是很好理解的,其实就是回文树的板子题,最后线性跑一边出现值就好了 #include<stdio.h> #include<string.h> #include<algorithm> usi...

qq_41925919的博客 172

bzoj3676 回文串【回文树】

解题思路: 回文树模板题,建好后取每个节点cnt*len的最大值即可。 回文树解析详见:http://blog.youkuaiyun.com/u013368721/article/details/42100363 真的好文。 #include #define ll long long using namespace std; int getint() { int i=0,f=1;char

cdsszjj的博客 416

bzoj 3676: [Apio2014]回文串 回文树(模板)

题目传送门 一篇很好的回文树学习博客 模板题 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N = 3e5+100; char str[N]; struct Palindromic_Tree { // 每一个节点表示一个回文串 int s[N]; int ne...

Pikachu的博客 194

BZOJ3676 回文串 (回文树)

题目大意考虑一个只包含小写拉丁字母的字符串ss。我们定义ss的一个子串tt的“出 现值”为tt在ss中的出现次数乘以t的长度。请你求出ss的所有回文子串中的最 大出现值。 题解回文树裸题,但是这里要注意一定要在最后统一推标记,否则全1串的时候一定会TLE。 这里附上一个写得很好的回文树讲解 回文树介绍(Palindromic Tree)代码#include <cstdio> #inclu

yashem66 832

[bzoj3676][Apio2014]回文串 回文自动机(回文树)

回文自动机

Unlimited Code Works 465

BZOJ.3676.[APIO2014]回文串(回文树)

BZOJ 洛谷 很久之前写(抄)过一个Hash+Manacher的做法,当时十分懵逼=-= 然而是道回文树模板题。 回文树教程可以看这里(真的挺妙的)。 顺便再放上MilkyWay的笔记~ //35100kb 708ms #include <cstdio> #include <cstring> #include <algorithm> #define gc(...

weixin_30460489的博客 123

bzoj3676 [Apio2014]回文串 (回文树)

题目: 考虑一个只包含小写拉丁字母的字符串s。我们定义s的一个子串t的“出现值”为t在s中的出现次数乘以t的长度。请你求出s的所有回文子串中的最大出现值。 分析: 回文树裸体。借此学习回文树,记录模板。 两个基本原理 对于任何一个串S,它的本质不同的回文串的个数不会超过|S|个 如果在串S后面加入一个字符,新增的本质不同的回文串的个数不会超过1个。 证明 利用数学归纳法来证明 ...

nbl97 258

BZOJ 3676 [Apio2014]回文串(回文树)

【题目链接】http://www.lydsy.com/JudgeOnline/problem.php?id=3676 【题目大意】   考虑一个只包含小写拉丁字母的字符串s。   我们定义s的一个子串t的"出现值"为t在s中的出现次数乘以t的长度。   求s的所有回文子串中的最大出现值。 【题解】   我们对给出串建立回文树,统计每个回文串出现次数和长度,相...

weixin_30726161的博客 111

BZOJ3676: [Apio2014]回文串 (回文树模板)

题意:求串s中每个回文串的长度与出现次数乘积的最大值。   思路:回文树裸题,求最大的cnt*len即可。 #include &lt;iostream&gt; #include &lt;cstdio&gt; #include &lt;cstring&gt; #include &lt;algorithm&gt; #include &lt;queue&gt; #include &lt;stac...

hcx11333的博客 273
上一篇: URAL - 1960 Palindromes and Super Abilities 回文树
下一篇: bzoj2160 拉拉队排练
我不会额
博客等级 码龄11年 2粉丝 173原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值