結果
問題 | No.273 回文分解 |
ユーザー |
|
提出日時 | 2025-03-11 23:12:54 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 801 bytes |
コンパイル時間 | 407 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 10,368 KB |
最終ジャッジ日時 | 2025-03-11 23:12:57 |
合計ジャッジ時間 | 3,091 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 WA * 11 |
ソースコード
def main(): inp = input() num = [] count = 0 ans = 2 length = len(inp) for i in inp: wid = ans while length - count >= wid: if wid % 2 == 0: if inp[count : count + wid // 2] == inp[count + wid -1 : count + wid //2 - 1 : -1]: ans = wid wid += 1 else: wid += 1 else: if inp[count : count + wid // 2 ] == inp[count + wid - 1 : count + wid // 2 : -1]: ans = wid wid += 1 else: wid += 1 count += 1 if length == 2: ans = 1 print(ans) if __name__ == '__main__': main()