제출 #739948

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
7399482023-05-11 17:49:33amirhoseinfar1385회문 (APIO14_palindrome)C++17
100 / 100
42 ms36208 KiB
//thanks sohsoh :)
#include<bits/stdc++.h>
using namespace std;
string s;
const int maxn=300000+10,maxl=27;
int nxt[maxn][maxl],cnt[maxn],f[maxn],len[maxn],now=0,sz=2;
void solve(int ind){
while(s[ind-len[now]-1]!=s[ind]){
// cout<<ind<<" "<<now<<" "<<len[now]<<"\n";
now=f[now];
}
//cout<<"salam "<<ind<<" "<<now<<" "<<len[now]<<"\n";
int c=s[ind]-'a';
if(nxt[now][c]==0){
nxt[now][c]=sz;
len[sz]=len[now]+2;
now=f[now];
while(s[ind-len[now]-1]!=s[ind]){
now=f[now];
}
if(len[sz]>1){
f[sz]=nxt[now][c];
}
else{
f[sz]=1;
}
now=sz;
cnt[now]++;
sz++;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...