結果

問題 No.1512 作文
ユーザー AAAR SalmonAAAR Salmon
提出日時 2021-05-21 21:44:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 411 ms / 2,000 ms
コード長 360 bytes
コンパイル時間 373 ms
コンパイル使用メモリ 82,212 KB
実行使用メモリ 138,796 KB
最終ジャッジ日時 2024-04-18 15:01:01
合計ジャッジ時間 4,990 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,364 KB
testcase_01 AC 36 ms
52,220 KB
testcase_02 AC 38 ms
52,140 KB
testcase_03 AC 37 ms
53,440 KB
testcase_04 AC 262 ms
93,364 KB
testcase_05 AC 269 ms
93,876 KB
testcase_06 AC 263 ms
93,488 KB
testcase_07 AC 255 ms
93,740 KB
testcase_08 AC 263 ms
93,412 KB
testcase_09 AC 36 ms
54,680 KB
testcase_10 AC 35 ms
54,972 KB
testcase_11 AC 35 ms
53,036 KB
testcase_12 AC 35 ms
53,028 KB
testcase_13 AC 36 ms
55,132 KB
testcase_14 AC 82 ms
76,392 KB
testcase_15 AC 100 ms
76,300 KB
testcase_16 AC 87 ms
76,508 KB
testcase_17 AC 80 ms
76,464 KB
testcase_18 AC 89 ms
76,652 KB
testcase_19 AC 81 ms
76,064 KB
testcase_20 AC 82 ms
76,600 KB
testcase_21 AC 36 ms
54,088 KB
testcase_22 AC 35 ms
52,508 KB
testcase_23 AC 34 ms
53,228 KB
testcase_24 AC 37 ms
52,776 KB
testcase_25 AC 35 ms
54,536 KB
testcase_26 AC 36 ms
51,696 KB
testcase_27 AC 35 ms
52,976 KB
testcase_28 AC 33 ms
52,052 KB
testcase_29 AC 37 ms
51,684 KB
testcase_30 AC 34 ms
52,976 KB
testcase_31 AC 36 ms
58,404 KB
testcase_32 AC 37 ms
58,652 KB
testcase_33 AC 38 ms
58,136 KB
testcase_34 AC 39 ms
60,512 KB
testcase_35 AC 41 ms
71,328 KB
testcase_36 AC 45 ms
72,512 KB
testcase_37 AC 43 ms
67,356 KB
testcase_38 AC 44 ms
72,028 KB
testcase_39 AC 49 ms
72,900 KB
testcase_40 AC 411 ms
138,796 KB
testcase_41 AC 202 ms
115,080 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = []
for _ in range(N):
	s = input()
	good = True
	for i in range(len(s) - 1):
		if s[i] > s[i + 1]:
			good = False
			break
	if good:
		S.append(s)
S.sort(key=lambda s: s[0])
S.sort(key=lambda s: s[-1])

dp = [0] * 26
for s in S:
	l = dp[ord(s[0]) - 97] + len(s)
	for j in range(ord(s[-1]) - 97, 26):
		dp[j] = max(dp[j], l)
print(dp[-1])
0