이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> PII;
const ll mx = 3e5+10;
const int A = 26;
const int N = 300010;
char s[N]; // 1-Indexed
int last, ptr, nxt[N][A], link[N], len[N], occ[N], depth[N], end_At[N];
void feed(int At) {
    while(s[At-len[last]-1]!=s[At])
        last = link[last];
    int ch = s[At]-'a', temp = link[last];
    while(s[At-len[temp]-1]!=s[At])
        temp = link[temp];
    if(!nxt[last][ch]) {
        nxt[last][ch] = ++ptr, len[ptr] = len[last]+2;
        link[ptr] = len[ptr]==1?2:nxt[temp][ch];
        //depth[ptr] = depth[link[ptr]] + 1;
    }
    last = nxt[last][ch], ++occ[last];
   // end_At[At] = depth[last];
}
int main() {
    int t = 1;
    while(t--) {
        len[1] = -1, link[1] = 1, len[2] = 0, link[2] = 1;
        ptr = last = 2;
        int n;
        scanf("%s", s + 1);
        for(int i=1; n = strlen(s+1), i<=n; i++) {
            feed(i);
        }
        for(int i = ptr; i > 2; i--) occ[link[i]] += occ[i];
        ll Ans = 0;
        for(int i=1; i<=ptr; i++) {
            ll p = len[i] * occ[i];
            Ans = max(Ans,p);
        }
        cout<<Ans<<"\n";
    }
}
컴파일 시 표준 에러 (stderr) 메시지
palindrome.cpp: In function 'int main()':
palindrome.cpp:39:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   39 |         scanf("%s", s + 1);
      |         ~~~~~^~~~~~~~~~~~~| # | 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... |