結果

問題 No.1512 作文
ユーザー SidewaysOwl
提出日時 2021-11-28 20:14:31
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 470 bytes
コンパイル時間 180 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 127,684 KB
最終ジャッジ日時 2024-07-01 15:14:28
合計ジャッジ時間 8,127 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 24 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
from collections import defaultdict
d = defaultdict(int)
S = []
d["A"] = 0
for _ in range(n):
    s = list(input())
    S.append([s,s[0]])
S.sort(key=lambda x:x[1])
for _ in range(n):
    s,xxx = S[_]
    if s != sorted(s):
        continue
    d_k = list(d.keys())
    for k in d_k:
        if s[0] < k:
            pass
        else:
            d[s[-1]] = max(d[k] + len(s),d[s[-1]])
    d[s[-1]] = max(len(s),d[s[-1]])        
print(max(d.values()))
0