結果
問題 |
No.273 回文分解
|
ユーザー |
|
提出日時 | 2020-06-08 15:22:20 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 267 bytes |
コンパイル時間 | 389 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 10,496 KB |
最終ジャッジ日時 | 2024-12-25 18:30:08 |
合計ジャッジ時間 | 2,763 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 WA * 4 |
ソースコード
import itertools S = input() is_palindrome = lambda S: S[:len(S) // 2] == S[-1:(-len(S) - 1) // 2:-1] ans = 1 for i, j in itertools.combinations(range(len(S) + 1), 2): if is_palindrome(S[i:j]): ans = max(ans, j - i) print(max(min(ans, len(S) - 2), 1))