結果

問題 No.1617 Palindrome Removal
ユーザー kimiyukikimiyuki
提出日時 2021-07-22 22:29:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 494 bytes
コンパイル時間 433 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 79,620 KB
最終ジャッジ日時 2023-09-24 17:43:19
合計ジャッジ時間 4,033 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
79,580 KB
testcase_01 AC 90 ms
79,540 KB
testcase_02 AC 91 ms
79,380 KB
testcase_03 AC 89 ms
79,404 KB
testcase_04 AC 90 ms
79,616 KB
testcase_05 AC 85 ms
78,796 KB
testcase_06 AC 88 ms
78,384 KB
testcase_07 AC 82 ms
77,376 KB
testcase_08 AC 69 ms
71,396 KB
testcase_09 AC 68 ms
71,028 KB
testcase_10 AC 90 ms
79,100 KB
testcase_11 AC 88 ms
78,820 KB
testcase_12 AC 93 ms
79,620 KB
testcase_13 AC 91 ms
79,620 KB
testcase_14 AC 69 ms
71,448 KB
testcase_15 AC 69 ms
71,408 KB
testcase_16 AC 67 ms
71,388 KB
testcase_17 AC 68 ms
71,436 KB
testcase_18 AC 69 ms
71,388 KB
testcase_19 AC 69 ms
71,352 KB
testcase_20 AC 71 ms
71,192 KB
testcase_21 AC 68 ms
71,328 KB
testcase_22 AC 66 ms
71,256 KB
testcase_23 AC 68 ms
71,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# from typing import *


def solve(s: str) -> int:
    if s != ''.join(reversed(s)):
        return len(s)
    if s == s[0] * len(s):
        if len(s) % 2 == 0:
            return 0
        else:
            return -1
    if len(s) == 3:
        return -1
    return len(s) - 2


# generated by oj-template v4.8.0 (https://github.com/online-judge-tools/template-generator)
def main():
    S = input()
    a = solve(S)
    print(a)


if __name__ == '__main__':
    main()
0