結果
| 問題 |
No.588 空白と回文
|
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-02-02 21:09:55 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 540 ms / 2,000 ms |
| コード長 | 638 bytes |
| コンパイル時間 | 83 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 44,348 KB |
| 最終ジャッジ日時 | 2024-09-18 21:25:07 |
| 合計ジャッジ時間 | 14,783 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
ソースコード
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
S = np.frombuffer(read().rstrip(),'S1')
N = len(S)
answer = 0
# 中心が n の場合
for n in range(N):
left = S[:n][::-1]
right = S[n+1:]
L = min(len(left), len(right))
x = np.count_nonzero(left[:L] == right[:L]) * 2 + 1
if answer < x:
answer = x
# 中心が間の場合
for n in range(N):
left = S[:n][::-1]
right = S[n:]
L = min(len(left), len(right))
x = np.count_nonzero(left[:L] == right[:L]) * 2
if answer < x:
answer = x
print(answer)
maspy