結果

問題 No.1512 作文
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-05-21 21:53:38
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 271 ms / 2,000 ms
コード長 514 bytes
コンパイル時間 493 ms
コンパイル使用メモリ 87,028 KB
実行使用メモリ 99,952 KB
最終ジャッジ日時 2023-07-31 15:10:00
合計ジャッジ時間 6,746 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,208 KB
testcase_01 AC 72 ms
71,344 KB
testcase_02 AC 71 ms
71,144 KB
testcase_03 AC 71 ms
71,192 KB
testcase_04 AC 270 ms
88,668 KB
testcase_05 AC 271 ms
88,188 KB
testcase_06 AC 270 ms
89,032 KB
testcase_07 AC 266 ms
88,056 KB
testcase_08 AC 263 ms
88,240 KB
testcase_09 AC 68 ms
71,116 KB
testcase_10 AC 68 ms
71,440 KB
testcase_11 AC 69 ms
71,412 KB
testcase_12 AC 68 ms
71,112 KB
testcase_13 AC 69 ms
71,300 KB
testcase_14 AC 117 ms
77,504 KB
testcase_15 AC 117 ms
78,096 KB
testcase_16 AC 114 ms
77,672 KB
testcase_17 AC 117 ms
77,556 KB
testcase_18 AC 115 ms
77,480 KB
testcase_19 AC 114 ms
78,136 KB
testcase_20 AC 117 ms
77,436 KB
testcase_21 AC 69 ms
71,124 KB
testcase_22 AC 68 ms
71,224 KB
testcase_23 AC 68 ms
71,248 KB
testcase_24 AC 70 ms
71,188 KB
testcase_25 AC 69 ms
71,360 KB
testcase_26 AC 67 ms
71,436 KB
testcase_27 AC 67 ms
71,312 KB
testcase_28 AC 65 ms
71,176 KB
testcase_29 AC 69 ms
71,312 KB
testcase_30 AC 73 ms
71,200 KB
testcase_31 AC 72 ms
75,812 KB
testcase_32 AC 76 ms
75,928 KB
testcase_33 AC 72 ms
75,844 KB
testcase_34 AC 74 ms
76,196 KB
testcase_35 AC 85 ms
90,156 KB
testcase_36 AC 84 ms
90,104 KB
testcase_37 AC 82 ms
84,232 KB
testcase_38 AC 80 ms
76,484 KB
testcase_39 AC 80 ms
76,628 KB
testcase_40 AC 263 ms
99,952 KB
testcase_41 AC 220 ms
99,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
L = [[] for i in range(26)]
for i in range(n):
    S = input()
    l = [-1]
    check = True
    for s in S:
        now = ord(s)-ord("a")
        if now < l[-1]:
            check = False
            break
        l.append(now)
    if check == False:
        continue
    L[l[1]].append([l[-1],len(l)-1])

dp = [0]*26

for i in range(26):
    dp[i] = max(dp[i],dp[i-1])
    if L[i] == []:
        continue
    L[i].sort()
    for r,le in L[i]:
        dp[r] = max(dp[r],dp[i]+le)
print(dp[-1])


0