結果

問題 No.1512 作文
ユーザー raven7959raven7959
提出日時 2021-08-05 10:22:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 340 bytes
コンパイル時間 323 ms
コンパイル使用メモリ 87,008 KB
実行使用メモリ 135,012 KB
最終ジャッジ日時 2023-10-14 21:30:44
合計ジャッジ時間 8,154 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 75 ms
71,320 KB
testcase_02 AC 80 ms
71,424 KB
testcase_03 AC 77 ms
71,324 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 89 ms
76,432 KB
testcase_10 AC 89 ms
76,304 KB
testcase_11 AC 88 ms
76,492 KB
testcase_12 AC 88 ms
76,276 KB
testcase_13 AC 86 ms
76,156 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 84 ms
75,936 KB
testcase_22 AC 84 ms
75,964 KB
testcase_23 AC 90 ms
76,196 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 74 ms
71,012 KB
testcase_27 AC 76 ms
71,240 KB
testcase_28 AC 74 ms
71,320 KB
testcase_29 AC 76 ms
71,264 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 83 ms
75,960 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 84 ms
76,052 KB
testcase_36 AC 82 ms
75,988 KB
testcase_37 AC 82 ms
75,792 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 384 ms
134,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
DP=[[0 for _ in range(26)] for _ in range(N+1)]
for i in range(N):
  S=input()
  flg=True
  for k in range(26):
    DP[i+1][k]=DP[i][k]
  if len(S)!=1:
    for j in range(len(S)-1):
      if S[j+1]<S[j]:
        flg=False
  if flg:
    s=S[0]
    g=S[-1]
    DP[i+1][ord(g)-97]=max(DP[i][:ord(s)-96])+len(S)
print(max(DP[N]))
0