結果

問題 No.1512 作文
ユーザー marroncastlemarroncastle
提出日時 2021-05-21 22:51:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 261 ms / 2,000 ms
コード長 378 bytes
コンパイル時間 370 ms
コンパイル使用メモリ 82,156 KB
実行使用メモリ 85,548 KB
最終ジャッジ日時 2024-04-18 16:19:07
合計ジャッジ時間 4,948 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
52,932 KB
testcase_01 AC 35 ms
52,884 KB
testcase_02 AC 35 ms
52,408 KB
testcase_03 AC 35 ms
52,000 KB
testcase_04 AC 216 ms
83,088 KB
testcase_05 AC 216 ms
83,248 KB
testcase_06 AC 213 ms
82,748 KB
testcase_07 AC 209 ms
83,208 KB
testcase_08 AC 211 ms
82,724 KB
testcase_09 AC 38 ms
53,472 KB
testcase_10 AC 36 ms
54,224 KB
testcase_11 AC 36 ms
54,252 KB
testcase_12 AC 37 ms
53,132 KB
testcase_13 AC 36 ms
54,280 KB
testcase_14 AC 88 ms
77,256 KB
testcase_15 AC 87 ms
77,292 KB
testcase_16 AC 89 ms
77,532 KB
testcase_17 AC 87 ms
76,856 KB
testcase_18 AC 89 ms
77,336 KB
testcase_19 AC 91 ms
76,984 KB
testcase_20 AC 88 ms
77,116 KB
testcase_21 AC 36 ms
52,836 KB
testcase_22 AC 36 ms
52,284 KB
testcase_23 AC 37 ms
52,824 KB
testcase_24 AC 38 ms
53,876 KB
testcase_25 AC 37 ms
54,664 KB
testcase_26 AC 35 ms
52,628 KB
testcase_27 AC 35 ms
52,340 KB
testcase_28 AC 35 ms
52,536 KB
testcase_29 AC 34 ms
52,144 KB
testcase_30 AC 34 ms
52,116 KB
testcase_31 AC 38 ms
58,932 KB
testcase_32 AC 39 ms
58,620 KB
testcase_33 AC 39 ms
58,164 KB
testcase_34 AC 42 ms
60,976 KB
testcase_35 AC 40 ms
60,736 KB
testcase_36 AC 43 ms
60,104 KB
testcase_37 AC 43 ms
66,332 KB
testcase_38 AC 50 ms
73,668 KB
testcase_39 AC 54 ms
75,212 KB
testcase_40 AC 261 ms
85,548 KB
testcase_41 AC 241 ms
83,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
dp = [0]*26
S = [input() for _ in range(N)]
S.sort()
for i in range(N):
  now = 0
  for s in S[i]:
    num = ord(s)-ord('a')
    if num<now:
      break
    now = num
  else:
    new_dp = dp[:]
    for j in range(ord(S[i][0])-ord('a')+1):
      new_dp[ord(S[i][-1])-ord('a')] = max(new_dp[ord(S[i][-1])-ord('a')], dp[j]+len(S[i]))
    dp = new_dp
print(max(dp))
0