# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
739948 | amirhoseinfar1385 | 회문 (APIO14_palindrome) | C++17 | 42 ms | 36208 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//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++;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |