結果

問題 No.273 回文分解
ユーザー 双六双六
提出日時 2020-08-09 00:49:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 50 ms / 2,000 ms
コード長 605 bytes
コンパイル時間 257 ms
コンパイル使用メモリ 82,468 KB
実行使用メモリ 66,536 KB
最終ジャッジ日時 2024-04-10 09:10:57
合計ジャッジ時間 2,835 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
54,928 KB
testcase_01 AC 41 ms
60,648 KB
testcase_02 AC 37 ms
54,848 KB
testcase_03 AC 38 ms
55,424 KB
testcase_04 AC 39 ms
54,528 KB
testcase_05 AC 41 ms
61,296 KB
testcase_06 AC 41 ms
60,700 KB
testcase_07 AC 39 ms
54,244 KB
testcase_08 AC 42 ms
61,292 KB
testcase_09 AC 41 ms
61,080 KB
testcase_10 AC 36 ms
54,968 KB
testcase_11 AC 37 ms
54,576 KB
testcase_12 AC 37 ms
54,732 KB
testcase_13 AC 37 ms
55,024 KB
testcase_14 AC 48 ms
64,208 KB
testcase_15 AC 38 ms
54,224 KB
testcase_16 AC 37 ms
55,588 KB
testcase_17 AC 39 ms
54,504 KB
testcase_18 AC 38 ms
55,400 KB
testcase_19 AC 41 ms
61,264 KB
testcase_20 AC 37 ms
54,072 KB
testcase_21 AC 38 ms
54,128 KB
testcase_22 AC 46 ms
65,528 KB
testcase_23 AC 47 ms
65,960 KB
testcase_24 AC 48 ms
65,660 KB
testcase_25 AC 48 ms
65,136 KB
testcase_26 AC 48 ms
66,424 KB
testcase_27 AC 50 ms
65,980 KB
testcase_28 AC 47 ms
66,536 KB
testcase_29 AC 44 ms
63,368 KB
testcase_30 AC 45 ms
64,464 KB
testcase_31 AC 37 ms
54,764 KB
testcase_32 AC 38 ms
54,920 KB
testcase_33 AC 37 ms
55,368 KB
testcase_34 AC 37 ms
54,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# import sys; input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")
from math import gcd

def getlist():
	return list(map(int, input().split()))

def judge(n, s):
	jud = "Yes"
	for i in range(n):
		if s[i] != s[-1 - i]:
			jud = "No"

	return jud

#処理内容
def main():
	S = input()
	N = len(S)
	ans = 0
	for i in range(N + 1):
		for j in range(i + 1, N + 1):
			s = S[i:j]
			n = len(s)
			if N != n:
				val = judge(n, s)
				if val == "Yes":
					ans = max(ans, n)

	print(ans)

if __name__ == '__main__':
	main()
0