結果

問題 No.1512 作文
ユーザー roarisroaris
提出日時 2021-05-23 23:45:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 482 ms / 2,000 ms
コード長 451 bytes
コンパイル時間 555 ms
コンパイル使用メモリ 87,136 KB
実行使用メモリ 135,580 KB
最終ジャッジ日時 2023-08-02 09:28:01
合計ジャッジ時間 10,282 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
71,504 KB
testcase_01 AC 64 ms
71,208 KB
testcase_02 AC 62 ms
71,448 KB
testcase_03 AC 64 ms
71,004 KB
testcase_04 AC 342 ms
106,140 KB
testcase_05 AC 339 ms
106,492 KB
testcase_06 AC 344 ms
106,268 KB
testcase_07 AC 342 ms
106,084 KB
testcase_08 AC 342 ms
106,236 KB
testcase_09 AC 65 ms
71,464 KB
testcase_10 AC 66 ms
71,468 KB
testcase_11 AC 62 ms
71,252 KB
testcase_12 AC 64 ms
71,328 KB
testcase_13 AC 64 ms
71,356 KB
testcase_14 AC 90 ms
77,640 KB
testcase_15 AC 94 ms
77,316 KB
testcase_16 AC 92 ms
77,448 KB
testcase_17 AC 92 ms
77,112 KB
testcase_18 AC 93 ms
77,380 KB
testcase_19 AC 96 ms
77,592 KB
testcase_20 AC 92 ms
77,364 KB
testcase_21 AC 65 ms
71,180 KB
testcase_22 AC 63 ms
71,388 KB
testcase_23 AC 65 ms
71,336 KB
testcase_24 AC 67 ms
71,556 KB
testcase_25 AC 66 ms
71,304 KB
testcase_26 AC 63 ms
71,232 KB
testcase_27 AC 62 ms
71,544 KB
testcase_28 AC 63 ms
71,356 KB
testcase_29 AC 62 ms
71,496 KB
testcase_30 AC 61 ms
71,024 KB
testcase_31 AC 65 ms
75,672 KB
testcase_32 AC 67 ms
75,728 KB
testcase_33 AC 63 ms
75,588 KB
testcase_34 AC 68 ms
75,660 KB
testcase_35 AC 69 ms
76,264 KB
testcase_36 AC 73 ms
76,264 KB
testcase_37 AC 69 ms
75,508 KB
testcase_38 AC 76 ms
76,804 KB
testcase_39 AC 75 ms
76,716 KB
testcase_40 AC 482 ms
135,580 KB
testcase_41 AC 241 ms
113,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N = int(input())
l = []

for _ in range(N):
    S = input()[:-1]
    
    for i in range(len(S)-1):
        if S[i]>S[i+1]:
            break
    else:
        l.append(S)

l.sort(key=lambda t: (t[0], t[-1]))
dp = [0]*26

for li in l:
    ndp = dp[:]
    
    for i in range(ord(li[0])-ord('a')+1):
        j = ord(li[-1])-ord('a')
        ndp[j] = max(ndp[j], dp[i]+len(li))
    
    dp = ndp[:]

print(max(dp))
0