結果
問題 |
No.273 回文分解
|
ユーザー |
![]() |
提出日時 | 2021-01-18 00:12:20 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 411 bytes |
コンパイル時間 | 253 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 137,984 KB |
最終ジャッジ日時 | 2024-11-30 06:44:41 |
合計ジャッジ時間 | 11,903 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 TLE * 3 |
ソースコード
def is_palindrome(s): return s == s[::-1] def f(s): if len(s) == 1: return 1 result = 0 for i in range(1, len(s)): a, b = s[:i], s[i:] if not is_palindrome(a): continue result = max(result, len(a)) if is_palindrome(b): result = max(result, len(b)) result = max(result, f(b)) return result S = input() print(f(S))