結果

問題 No.1617 Palindrome Removal
ユーザー trineutrontrineutron
提出日時 2021-07-22 21:28:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 442 ms / 2,000 ms
コード長 236 bytes
コンパイル時間 552 ms
コンパイル使用メモリ 10,724 KB
実行使用メモリ 10,532 KB
最終ジャッジ日時 2023-09-24 15:38:05
合計ジャッジ時間 5,349 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 389 ms
10,444 KB
testcase_01 AC 442 ms
9,880 KB
testcase_02 AC 346 ms
9,736 KB
testcase_03 AC 342 ms
10,532 KB
testcase_04 AC 280 ms
9,916 KB
testcase_05 AC 197 ms
10,228 KB
testcase_06 AC 19 ms
9,876 KB
testcase_07 AC 17 ms
9,124 KB
testcase_08 AC 15 ms
7,920 KB
testcase_09 AC 15 ms
7,876 KB
testcase_10 AC 256 ms
10,480 KB
testcase_11 AC 220 ms
9,572 KB
testcase_12 AC 266 ms
9,872 KB
testcase_13 AC 245 ms
9,860 KB
testcase_14 AC 15 ms
8,056 KB
testcase_15 AC 15 ms
7,944 KB
testcase_16 AC 14 ms
7,768 KB
testcase_17 AC 14 ms
7,824 KB
testcase_18 AC 15 ms
7,796 KB
testcase_19 AC 14 ms
7,788 KB
testcase_20 AC 15 ms
7,960 KB
testcase_21 AC 14 ms
8,004 KB
testcase_22 AC 14 ms
7,788 KB
testcase_23 AC 14 ms
7,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input()
n = len(s)

for i in range(n):
    if s[i] != s[n - i - 1]:
        print(n)
        exit()

for i in range(n):
    if n >= 4 and s[i] != s[0]:
        print(n - 2)
        exit()

if n % 2:
    print(-1)
else:
    print(0)
0