結果
問題 | No.1617 Palindrome Removal |
ユーザー | ntuda |
提出日時 | 2021-09-05 22:27:59 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 486 bytes |
コンパイル時間 | 289 ms |
コンパイル使用メモリ | 87,140 KB |
実行使用メモリ | 80,148 KB |
最終ジャッジ日時 | 2023-08-24 05:29:30 |
合計ジャッジ時間 | 5,967 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 148 ms
78,228 KB |
testcase_01 | AC | 153 ms
78,644 KB |
testcase_02 | AC | 154 ms
80,128 KB |
testcase_03 | AC | 154 ms
79,872 KB |
testcase_04 | AC | 158 ms
80,148 KB |
testcase_05 | AC | 149 ms
79,036 KB |
testcase_06 | AC | 163 ms
79,924 KB |
testcase_07 | AC | 137 ms
78,384 KB |
testcase_08 | AC | 94 ms
71,368 KB |
testcase_09 | AC | 93 ms
71,380 KB |
testcase_10 | AC | 157 ms
79,624 KB |
testcase_11 | AC | 154 ms
79,308 KB |
testcase_12 | AC | 162 ms
79,712 KB |
testcase_13 | AC | 161 ms
79,788 KB |
testcase_14 | AC | 94 ms
71,220 KB |
testcase_15 | AC | 95 ms
71,492 KB |
testcase_16 | AC | 94 ms
71,496 KB |
testcase_17 | AC | 95 ms
71,308 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 96 ms
71,320 KB |
testcase_21 | AC | 95 ms
71,348 KB |
testcase_22 | AC | 95 ms
71,380 KB |
testcase_23 | AC | 94 ms
71,316 KB |
ソースコード
import collections,sys S = input() D = collections.Counter(S) ND = len(D) N = len(S) if N == 1: print(-1) elif N == 2: if ND == 1: print(0) else: print(N) elif N == 3: if ND == 1: print(-1) elif S[0] == S[2]: print(1) else: print(3) else: if ND == 1: if N % 2 == 0: print(0) else: print(-1) elif S[:N//2] == S[:-(-N//2)-1:-1]: print(N-2) else: print(N)