結果

問題 No.273 回文分解
ユーザー H3PO4H3PO4
提出日時 2020-06-08 15:22:20
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
WA  
実行時間 -
コード長 267 bytes
コンパイル時間 196 ms
コンパイル使用メモリ 10,692 KB
実行使用メモリ 8,136 KB
最終ジャッジ日時 2023-08-26 18:20:37
合計ジャッジ時間 2,719 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,996 KB
testcase_01 AC 16 ms
7,964 KB
testcase_02 AC 16 ms
7,984 KB
testcase_03 AC 16 ms
7,912 KB
testcase_04 AC 16 ms
8,068 KB
testcase_05 AC 16 ms
7,984 KB
testcase_06 AC 16 ms
7,980 KB
testcase_07 AC 16 ms
7,940 KB
testcase_08 AC 16 ms
7,932 KB
testcase_09 AC 16 ms
8,076 KB
testcase_10 AC 16 ms
8,000 KB
testcase_11 AC 15 ms
7,928 KB
testcase_12 AC 20 ms
7,992 KB
testcase_13 AC 15 ms
8,000 KB
testcase_14 AC 16 ms
7,956 KB
testcase_15 AC 16 ms
8,076 KB
testcase_16 AC 16 ms
8,024 KB
testcase_17 AC 16 ms
7,996 KB
testcase_18 AC 16 ms
8,092 KB
testcase_19 AC 16 ms
8,080 KB
testcase_20 AC 15 ms
8,016 KB
testcase_21 AC 16 ms
7,956 KB
testcase_22 WA -
testcase_23 AC 17 ms
8,036 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 17 ms
7,952 KB
testcase_27 AC 16 ms
8,012 KB
testcase_28 AC 16 ms
8,008 KB
testcase_29 AC 17 ms
7,928 KB
testcase_30 AC 16 ms
7,912 KB
testcase_31 AC 16 ms
7,972 KB
testcase_32 AC 16 ms
7,996 KB
testcase_33 WA -
testcase_34 AC 16 ms
8,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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))
0