結果

問題 No.1512 作文
ユーザー SidewaysOwlSidewaysOwl
提出日時 2021-11-28 20:14:31
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 470 bytes
コンパイル時間 908 ms
コンパイル使用メモリ 86,812 KB
実行使用メモリ 129,180 KB
最終ジャッジ日時 2023-09-14 07:49:23
合計ジャッジ時間 10,772 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
71,100 KB
testcase_01 AC 94 ms
71,556 KB
testcase_02 AC 95 ms
71,380 KB
testcase_03 AC 96 ms
71,492 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 128 ms
73,508 KB
testcase_10 AC 131 ms
73,820 KB
testcase_11 AC 128 ms
73,492 KB
testcase_12 AC 134 ms
74,548 KB
testcase_13 AC 129 ms
73,332 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 99 ms
72,468 KB
testcase_22 AC 92 ms
71,592 KB
testcase_23 AC 99 ms
72,636 KB
testcase_24 AC 100 ms
72,744 KB
testcase_25 AC 101 ms
72,592 KB
testcase_26 AC 95 ms
71,460 KB
testcase_27 AC 98 ms
71,528 KB
testcase_28 AC 97 ms
71,652 KB
testcase_29 AC 97 ms
71,404 KB
testcase_30 AC 96 ms
71,132 KB
testcase_31 AC 96 ms
71,576 KB
testcase_32 AC 94 ms
71,628 KB
testcase_33 AC 95 ms
71,596 KB
testcase_34 AC 101 ms
72,736 KB
testcase_35 AC 110 ms
77,612 KB
testcase_36 AC 108 ms
77,276 KB
testcase_37 AC 101 ms
75,332 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 797 ms
129,180 KB
testcase_41 AC 415 ms
128,116 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.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