結果
| 問題 | No.273 回文分解 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-05-22 09:18:33 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 517 bytes | 
| コンパイル時間 | 259 ms | 
| コンパイル使用メモリ | 82,188 KB | 
| 実行使用メモリ | 513,328 KB | 
| 最終ジャッジ日時 | 2024-12-20 18:21:16 | 
| 合計ジャッジ時間 | 12,157 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 28 TLE * 3 MLE * 1 | 
ソースコード
from collections import deque
S = input().rstrip()
lst = deque([(0, 0)])
MAX = 0
while len(lst) > 0:
    k, cnt = lst.popleft()
    c = S[k]
    for i in range(k, len(S)):
        if S[i] == c:
            for j in range(0, (i - k + 1) // 2):
                if S[k + j] != S[i - j]:
                    break
            else:
                if i != len(S) - 1 or cnt > 0:
                    MAX = max(MAX, i - k + 1)
                if i != len(S) - 1:
                    lst.append((i + 1, cnt + 1))
print(MAX)
            
            
            
        