結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,520 KB
testcase_01 AC 89 ms
71,820 KB
testcase_02 AC 94 ms
71,940 KB
testcase_03 AC 90 ms
71,876 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 89 ms
71,868 KB
testcase_23 AC 96 ms
72,828 KB
testcase_24 AC 97 ms
72,956 KB
testcase_25 AC 94 ms
72,940 KB
testcase_26 AC 89 ms
71,836 KB
testcase_27 RE -
testcase_28 AC 90 ms
71,484 KB
testcase_29 AC 88 ms
71,808 KB
testcase_30 AC 89 ms
71,832 KB
testcase_31 AC 89 ms
71,868 KB
testcase_32 AC 88 ms
71,832 KB
testcase_33 AC 90 ms
71,484 KB
testcase_34 AC 96 ms
73,088 KB
testcase_35 AC 105 ms
77,452 KB
testcase_36 AC 104 ms
77,436 KB
testcase_37 AC 100 ms
75,776 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 831 ms
129,672 KB
testcase_41 AC 374 ms
128,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
from collections import defaultdict
d = defaultdict(int)
S = []
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