結果

問題 No.1512 作文
ユーザー SidewaysOwlSidewaysOwl
提出日時 2021-11-28 20:15:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 485 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 87,216 KB
実行使用メモリ 148,904 KB
最終ジャッジ日時 2023-09-14 07:50:46
合計ジャッジ時間 13,172 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
71,836 KB
testcase_01 AC 90 ms
71,836 KB
testcase_02 AC 93 ms
71,904 KB
testcase_03 AC 90 ms
71,868 KB
testcase_04 AC 812 ms
126,852 KB
testcase_05 WA -
testcase_06 AC 801 ms
126,736 KB
testcase_07 AC 811 ms
126,768 KB
testcase_08 AC 833 ms
126,824 KB
testcase_09 AC 123 ms
73,504 KB
testcase_10 AC 129 ms
74,008 KB
testcase_11 AC 122 ms
73,796 KB
testcase_12 AC 130 ms
74,616 KB
testcase_13 AC 125 ms
73,652 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 96 ms
73,032 KB
testcase_22 AC 91 ms
71,856 KB
testcase_23 AC 98 ms
72,804 KB
testcase_24 AC 97 ms
72,972 KB
testcase_25 AC 95 ms
72,752 KB
testcase_26 AC 93 ms
71,780 KB
testcase_27 AC 90 ms
71,896 KB
testcase_28 AC 90 ms
71,608 KB
testcase_29 AC 91 ms
71,960 KB
testcase_30 AC 92 ms
71,856 KB
testcase_31 AC 92 ms
71,492 KB
testcase_32 AC 92 ms
71,652 KB
testcase_33 AC 92 ms
71,620 KB
testcase_34 AC 98 ms
72,760 KB
testcase_35 AC 105 ms
77,608 KB
testcase_36 AC 108 ms
77,908 KB
testcase_37 AC 103 ms
75,584 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 957 ms
148,904 KB
testcase_41 AC 413 ms
136,016 KB
権限があれば一括ダウンロードができます

ソースコード

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[-1]])
S.sort(key=lambda x:(x[1],x[2]))
for _ in range(n):
    s,xx,yy = 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