結果

問題 No.1512 作文
ユーザー tamatotamato
提出日時 2021-05-21 21:27:49
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 582 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 82,460 KB
実行使用メモリ 119,496 KB
最終ジャッジ日時 2024-04-18 14:28:46
合計ジャッジ時間 5,496 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,224 KB
testcase_01 AC 39 ms
52,224 KB
testcase_02 AC 38 ms
52,224 KB
testcase_03 AC 41 ms
52,352 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 74 ms
69,504 KB
testcase_10 AC 75 ms
69,504 KB
testcase_11 AC 80 ms
69,760 KB
testcase_12 AC 74 ms
70,272 KB
testcase_13 AC 79 ms
70,272 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 47 ms
58,496 KB
testcase_22 AC 44 ms
57,984 KB
testcase_23 AC 43 ms
59,136 KB
testcase_24 AC 46 ms
58,880 KB
testcase_25 AC 42 ms
59,136 KB
testcase_26 AC 38 ms
52,272 KB
testcase_27 AC 42 ms
52,352 KB
testcase_28 AC 41 ms
52,096 KB
testcase_29 AC 41 ms
52,096 KB
testcase_30 AC 40 ms
52,480 KB
testcase_31 AC 44 ms
57,600 KB
testcase_32 AC 40 ms
57,728 KB
testcase_33 AC 44 ms
57,728 KB
testcase_34 AC 44 ms
59,648 KB
testcase_35 AC 69 ms
84,700 KB
testcase_36 AC 70 ms
84,524 KB
testcase_37 AC 52 ms
71,168 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 380 ms
119,496 KB
testcase_41 AC 249 ms
118,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    T = []
    for _ in range(N):
        S = input().rstrip('\n')
        S = [s for s in S]
        SS = sorted(S)
        if S == SS:
            T.append((S[0], S[-1], len(S)))
    for i in range(25):
        T.append((chr(i+97), chr(i+98), 0))
    T.sort(key=lambda x: x[0])
    dp = [0] * 26
    for a, b, l in T:
        aa = ord(a) - 97
        bb = ord(b) - 97
        dp[bb] = max(dp[bb], dp[aa] + l)
    print(max(dp))


if __name__ == '__main__':
    main()
0