結果
問題 |
No.273 回文分解
|
ユーザー |
![]() |
提出日時 | 2021-01-18 00:11:30 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 411 bytes |
コンパイル時間 | 289 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 21,120 KB |
最終ジャッジ日時 | 2024-11-30 06:43:49 |
合計ジャッジ時間 | 11,560 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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))