結果

問題 No.1512 作文
ユーザー marroncastlemarroncastle
提出日時 2021-05-21 22:48:16
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 336 bytes
コンパイル時間 214 ms
コンパイル使用メモリ 82,272 KB
実行使用メモリ 76,728 KB
最終ジャッジ日時 2024-04-18 16:16:19
合計ジャッジ時間 4,133 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 38 ms
52,740 KB
testcase_02 AC 39 ms
52,992 KB
testcase_03 AC 36 ms
52,016 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 37 ms
53,280 KB
testcase_10 AC 37 ms
53,960 KB
testcase_11 AC 38 ms
54,932 KB
testcase_12 AC 37 ms
54,656 KB
testcase_13 AC 39 ms
53,164 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 39 ms
52,732 KB
testcase_22 AC 38 ms
51,888 KB
testcase_23 AC 40 ms
53,756 KB
testcase_24 AC 40 ms
54,392 KB
testcase_25 WA -
testcase_26 AC 37 ms
52,988 KB
testcase_27 AC 36 ms
53,060 KB
testcase_28 AC 37 ms
53,008 KB
testcase_29 AC 36 ms
53,280 KB
testcase_30 AC 36 ms
53,060 KB
testcase_31 AC 39 ms
57,860 KB
testcase_32 AC 42 ms
58,784 KB
testcase_33 AC 38 ms
58,580 KB
testcase_34 AC 41 ms
60,424 KB
testcase_35 AC 40 ms
59,276 KB
testcase_36 AC 41 ms
59,360 KB
testcase_37 AC 42 ms
67,860 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 174 ms
76,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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