結果

問題 No.1512 作文
ユーザー KudeKude
提出日時 2021-05-21 21:27:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 449 ms / 2,000 ms
コード長 411 bytes
コンパイル時間 451 ms
コンパイル使用メモリ 82,148 KB
実行使用メモリ 104,876 KB
最終ジャッジ日時 2024-04-18 14:28:23
合計ジャッジ時間 5,881 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
51,752 KB
testcase_01 AC 36 ms
53,336 KB
testcase_02 AC 36 ms
52,372 KB
testcase_03 AC 37 ms
52,436 KB
testcase_04 AC 339 ms
89,168 KB
testcase_05 AC 332 ms
89,444 KB
testcase_06 AC 338 ms
89,152 KB
testcase_07 AC 342 ms
89,268 KB
testcase_08 AC 335 ms
89,204 KB
testcase_09 AC 36 ms
53,456 KB
testcase_10 AC 37 ms
54,184 KB
testcase_11 AC 37 ms
54,688 KB
testcase_12 AC 36 ms
53,300 KB
testcase_13 AC 40 ms
54,004 KB
testcase_14 AC 94 ms
76,616 KB
testcase_15 AC 111 ms
76,784 KB
testcase_16 AC 96 ms
76,552 KB
testcase_17 AC 91 ms
76,532 KB
testcase_18 AC 93 ms
76,396 KB
testcase_19 AC 88 ms
76,764 KB
testcase_20 AC 86 ms
76,956 KB
testcase_21 AC 37 ms
53,476 KB
testcase_22 AC 36 ms
52,864 KB
testcase_23 AC 37 ms
54,528 KB
testcase_24 AC 39 ms
53,636 KB
testcase_25 AC 38 ms
52,740 KB
testcase_26 AC 36 ms
53,068 KB
testcase_27 AC 36 ms
52,992 KB
testcase_28 AC 37 ms
52,268 KB
testcase_29 AC 37 ms
52,348 KB
testcase_30 AC 36 ms
52,944 KB
testcase_31 AC 40 ms
59,104 KB
testcase_32 AC 41 ms
59,496 KB
testcase_33 AC 38 ms
58,180 KB
testcase_34 AC 42 ms
61,584 KB
testcase_35 AC 46 ms
72,396 KB
testcase_36 AC 44 ms
72,148 KB
testcase_37 AC 43 ms
66,764 KB
testcase_38 AC 48 ms
73,564 KB
testcase_39 AC 55 ms
75,696 KB
testcase_40 AC 449 ms
104,876 KB
testcase_41 AC 252 ms
96,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = []
for _ in range(n):
    t = input()
    ok = True
    for i in range(len(t) - 1):
        if t[i] > t[i + 1]:
            ok = False
            break
    if ok:
        a = ord(t[0]) - ord('a')
        b = ord(t[-1]) - ord('a')
        s.append((a, b, len(t)))
s.sort()
dp = [0] * 27
for a, b, l in s:
    for i in range(a + 1)[::-1]:
        dp[b] = max(dp[b], dp[i] + l)
print(max(dp))
0