結果

問題 No.273 回文分解
ユーザー rlangevinrlangevin
提出日時 2023-01-14 13:16:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 329 bytes
コンパイル時間 740 ms
コンパイル使用メモリ 86,484 KB
実行使用メモリ 76,532 KB
最終ジャッジ日時 2023-08-26 19:36:47
合計ジャッジ時間 4,623 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,148 KB
testcase_01 AC 70 ms
74,916 KB
testcase_02 AC 68 ms
71,340 KB
testcase_03 AC 69 ms
71,204 KB
testcase_04 AC 68 ms
71,184 KB
testcase_05 AC 67 ms
74,932 KB
testcase_06 AC 69 ms
75,160 KB
testcase_07 AC 64 ms
71,160 KB
testcase_08 AC 76 ms
75,396 KB
testcase_09 AC 67 ms
75,008 KB
testcase_10 AC 61 ms
71,284 KB
testcase_11 AC 64 ms
71,000 KB
testcase_12 AC 64 ms
71,184 KB
testcase_13 AC 63 ms
71,176 KB
testcase_14 AC 80 ms
76,532 KB
testcase_15 AC 69 ms
71,460 KB
testcase_16 AC 71 ms
71,048 KB
testcase_17 AC 69 ms
71,088 KB
testcase_18 AC 67 ms
71,172 KB
testcase_19 AC 69 ms
74,992 KB
testcase_20 AC 65 ms
71,196 KB
testcase_21 AC 63 ms
71,172 KB
testcase_22 AC 73 ms
76,356 KB
testcase_23 AC 73 ms
76,500 KB
testcase_24 AC 74 ms
76,404 KB
testcase_25 AC 78 ms
76,344 KB
testcase_26 AC 76 ms
76,256 KB
testcase_27 AC 77 ms
76,340 KB
testcase_28 AC 74 ms
76,360 KB
testcase_29 AC 72 ms
75,188 KB
testcase_30 AC 74 ms
76,484 KB
testcase_31 AC 67 ms
71,352 KB
testcase_32 AC 64 ms
71,284 KB
testcase_33 AC 65 ms
71,492 KB
testcase_34 AC 66 ms
71,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(L):
    N = len(L)
    temp = [None] * N
    for i in range(N):
        temp[i] = L[N - 1 - i]
    return L == temp

S = list(input())
M = len(S)
ans = 1
for i in range(M):
    for j in range(i + 1, M):
        if j - i == M - 1:
            continue
        if f(S[i:j+1]):
            ans = max(ans, j + 1 - i)
print(ans)
0