結果

問題 No.588 空白と回文
ユーザー 👑 KazunKazun
提出日時 2020-11-27 03:56:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 596 bytes
コンパイル時間 110 ms
コンパイル使用メモリ 10,872 KB
実行使用メモリ 13,532 KB
最終ジャッジ日時 2023-10-01 03:53:30
合計ジャッジ時間 3,924 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
13,532 KB
testcase_01 AC 27 ms
8,988 KB
testcase_02 AC 25 ms
9,160 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from string import ascii_lowercase

X=ascii_lowercase+"0123456789"
D={x:[] for x in X}

S=input()
N=len(S)

for i in range(N):
    D[S[i]].append(i)

#長さが奇数
K=0
for i in range(N):
    e=1
    A=1
    while 0<=i-e and i+e<N:
        if S[i-e]==S[i+e]:A+=2
        e+=1
    K=max(K,A)

#長さが偶数
for x in D:
    E=D[x]
    L=len(E)

    for i in range(L):
        p=E[i]
        for j in range(i+1,L):
            e=1
            A=2
            q=E[j]
            while 0<=p-e and q+e<N:
                if S[p-e]==S[q+e]:A+=2
                e+=1
            K=max(K,A)

print(K)
0