제출 #5523

#제출 시각아이디문제언어결과실행 시간메모리
5523gs12117회문 (APIO14_palindrome)C++98
47 / 100
1000 ms48268 KiB
#include<stdio.h> #include<string.h> #include<algorithm> int n; char a[300100]; int b[600100]; int q[30][300100]; int qe[30]; int grp[600100]; int grd[600100]; int ngrp[600100]; int ngrd[600100]; int grn; int grk; int ans; int main(){ int i,j,k,pn; scanf("%s",a); n=strlen(a); for(i=0;i<n;i++){ b[2*i+2]=a[i]-'a'+1; } b[0]=27; b[2*n+2]=28; n=2*n+3; for(i=0;i<n;i++){ grd[i]=i; } grn=n; for(i=0;grn;i++){ for(j=0;j<29;j++){ qe[j]=0; } for(j=0;j<grn;j++){ if(b[grd[j]-i]==b[grd[j]+i]){ k=b[grd[j]-i]; q[k][qe[k]]=j; qe[k]++; } } grn=0; grk=0; for(j=0;j<29;j++){ pn=0; for(k=0;k<qe[j];k++){ ngrp[grn]=grk; ngrd[grn]=grd[q[j][k]]; grn++; pn++; if(k+1==qe[j]||grp[q[j][k]]!=grp[q[j][k+1]]){ if(ans<pn*i)ans=pn*i; pn=0; grk++; } } } for(j=0;j<grn;j++){ grd[j]=ngrd[j]; grp[j]=ngrp[j]; } } printf("%d",ans); }
#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...