結果

問題 No.1512 作文
ユーザー hir355hir355
提出日時 2021-05-21 21:26:57
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 374 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 90,116 KB
最終ジャッジ日時 2024-04-18 14:27:03
合計ジャッジ時間 5,091 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 36 ms
51,840 KB
testcase_02 AC 40 ms
51,968 KB
testcase_03 AC 37 ms
51,968 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 78 ms
71,808 KB
testcase_10 AC 80 ms
72,088 KB
testcase_11 AC 74 ms
71,624 KB
testcase_12 AC 83 ms
72,704 KB
testcase_13 AC 80 ms
72,032 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 38 ms
54,016 KB
testcase_22 WA -
testcase_23 AC 39 ms
54,656 KB
testcase_24 AC 41 ms
55,424 KB
testcase_25 AC 39 ms
55,168 KB
testcase_26 AC 34 ms
51,584 KB
testcase_27 AC 37 ms
51,584 KB
testcase_28 AC 36 ms
52,096 KB
testcase_29 AC 35 ms
52,096 KB
testcase_30 AC 34 ms
52,096 KB
testcase_31 AC 36 ms
52,352 KB
testcase_32 AC 36 ms
52,736 KB
testcase_33 AC 36 ms
52,264 KB
testcase_34 AC 39 ms
55,424 KB
testcase_35 AC 72 ms
90,116 KB
testcase_36 AC 69 ms
89,844 KB
testcase_37 AC 48 ms
71,552 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
dp = [0] * 26
g = [[] for _ in range(26)]
ans = 0
for i in range(n):
    s = input()
    if sorted(s) == list(s):
        if s[0] == s[-1]:
            ans += len(s)
        g[ord(s[0]) - 97].append((ord(s[-1]) - 97, len(s)))
for i in range(25):
    for j, c in g[i]:
        dp[j] = max(dp[j], dp[i] + c)
    dp[i + 1] = max(dp[i + 1], dp[i])
print(dp[-1])
0