結果

問題 No.52 よくある文字列の問題
ユーザー TawaraTawara
提出日時 2015-10-16 09:15:15
言語 Python2
(2.7.18)
結果
AC  
実行時間 13 ms / 5,000 ms
コード長 316 bytes
コンパイル時間 52 ms
コンパイル使用メモリ 7,128 KB
実行使用メモリ 6,624 KB
最終ジャッジ日時 2023-10-22 04:01:01
合計ジャッジ時間 752 ms
ジャッジサーバーID
(参考情報)
judge9 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,468 KB
testcase_01 AC 11 ms
6,468 KB
testcase_02 AC 11 ms
6,468 KB
testcase_03 AC 11 ms
6,468 KB
testcase_04 AC 12 ms
6,624 KB
testcase_05 AC 13 ms
6,476 KB
testcase_06 AC 12 ms
6,600 KB
testcase_07 AC 12 ms
6,492 KB
testcase_08 AC 11 ms
6,468 KB
testcase_09 AC 11 ms
6,468 KB
testcase_10 AC 12 ms
6,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = raw_input()
dp = {(0,0):set([""])}
for i in xrange(len(S)):
	ndp = {}
	for k,s in dp.iteritems():
		for f,b in ((1,0),(0,1)):
			n = (k[0]+f,k[1]+b)
			if n not in ndp:
				ndp[n] = set()
			for v in s:
				ndp[n].add(v+(S[n[0]-1] if f else S[-n[1]]))
	dp = ndp
print len(set(v for s in dp.values() for v in s))
0