結果

問題 No.1512 作文
ユーザー roarisroaris
提出日時 2021-05-23 23:45:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 527 ms / 2,000 ms
コード長 451 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 82,260 KB
実行使用メモリ 132,764 KB
最終ジャッジ日時 2024-04-20 08:55:29
合計ジャッジ時間 6,406 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,096 KB
testcase_01 AC 37 ms
51,840 KB
testcase_02 AC 37 ms
51,968 KB
testcase_03 AC 37 ms
52,216 KB
testcase_04 AC 367 ms
105,280 KB
testcase_05 AC 364 ms
105,152 KB
testcase_06 AC 362 ms
105,044 KB
testcase_07 AC 375 ms
105,024 KB
testcase_08 AC 376 ms
105,304 KB
testcase_09 AC 39 ms
53,632 KB
testcase_10 AC 39 ms
53,120 KB
testcase_11 AC 39 ms
52,864 KB
testcase_12 AC 39 ms
53,248 KB
testcase_13 AC 39 ms
53,120 KB
testcase_14 AC 73 ms
76,800 KB
testcase_15 AC 80 ms
76,168 KB
testcase_16 AC 77 ms
76,416 KB
testcase_17 AC 77 ms
76,284 KB
testcase_18 AC 78 ms
76,768 KB
testcase_19 AC 77 ms
76,288 KB
testcase_20 AC 77 ms
76,080 KB
testcase_21 AC 38 ms
51,968 KB
testcase_22 AC 38 ms
52,608 KB
testcase_23 AC 39 ms
52,608 KB
testcase_24 AC 38 ms
52,480 KB
testcase_25 AC 39 ms
52,608 KB
testcase_26 AC 39 ms
52,352 KB
testcase_27 AC 37 ms
52,096 KB
testcase_28 AC 38 ms
51,840 KB
testcase_29 AC 38 ms
51,968 KB
testcase_30 AC 39 ms
52,480 KB
testcase_31 AC 43 ms
57,984 KB
testcase_32 AC 41 ms
58,112 KB
testcase_33 AC 41 ms
57,856 KB
testcase_34 AC 43 ms
59,520 KB
testcase_35 AC 48 ms
71,680 KB
testcase_36 AC 47 ms
71,296 KB
testcase_37 AC 45 ms
66,304 KB
testcase_38 AC 53 ms
74,240 KB
testcase_39 AC 54 ms
73,984 KB
testcase_40 AC 527 ms
132,764 KB
testcase_41 AC 252 ms
114,736 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