結果
問題 |
No.588 空白と回文
|
ユーザー |
![]() |
提出日時 | 2017-11-03 23:53:39 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 863 bytes |
コンパイル時間 | 145 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-11-23 15:11:47 |
合計ジャッジ時間 | 3,830 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 15 WA * 10 |
ソースコード
inputed_list = list(input()) res = 1 tmp_list = [] for i in range(len(inputed_list)): tmp_list.clear() for e in inputed_list: tmp_list.append(e) j = 1 length = 1 limit = 0 if i < len(inputed_list) // 2: limit = i else: limit = len(inputed_list) - i for k in range(limit): try: b = tmp_list[i - j] f = tmp_list[i + j] if b == f or (b == 'b' and f == 'd') or (b == 'd' and f == 'b') or ( b == 'p' and f == 'q') or (b == 'q' and f == 'p'): length += 1 res = max(res, length) j += 1 else: tmp_list[i - j] = ' ' tmp_list[i + j] = ' ' j += 1 except: break if res == 1: print(0) else: print(res * 2 - 1)