結果

問題 No.1512 作文
ユーザー SidewaysOwlSidewaysOwl
提出日時 2021-11-28 19:52:56
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 367 bytes
コンパイル時間 314 ms
コンパイル使用メモリ 87,268 KB
実行使用メモリ 80,668 KB
最終ジャッジ日時 2023-09-14 07:28:14
合計ジャッジ時間 9,068 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 91 ms
71,668 KB
testcase_02 AC 95 ms
71,576 KB
testcase_03 AC 91 ms
71,480 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 RE -
testcase_22 AC 94 ms
71,824 KB
testcase_23 AC 98 ms
72,268 KB
testcase_24 AC 100 ms
72,508 KB
testcase_25 WA -
testcase_26 AC 95 ms
71,768 KB
testcase_27 RE -
testcase_28 AC 93 ms
71,796 KB
testcase_29 AC 96 ms
71,756 KB
testcase_30 AC 94 ms
71,768 KB
testcase_31 AC 94 ms
71,812 KB
testcase_32 AC 94 ms
71,668 KB
testcase_33 AC 93 ms
71,652 KB
testcase_34 AC 102 ms
76,244 KB
testcase_35 AC 107 ms
77,848 KB
testcase_36 AC 109 ms
77,668 KB
testcase_37 AC 103 ms
75,896 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 263 ms
78,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
from collections import defaultdict
d = defaultdict(int)
for _ in range(n):
    s = list(input())
    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