結果

問題 No.1512 作文
ユーザー irumo8202irumo8202
提出日時 2022-02-13 15:58:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 566 bytes
コンパイル時間 348 ms
コンパイル使用メモリ 10,772 KB
実行使用メモリ 29,168 KB
最終ジャッジ日時 2023-09-11 15:32:56
合計ジャッジ時間 9,070 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 18 ms
8,636 KB
testcase_02 AC 19 ms
8,440 KB
testcase_03 AC 19 ms
8,504 KB
testcase_04 AC 630 ms
18,968 KB
testcase_05 AC 622 ms
18,832 KB
testcase_06 AC 620 ms
18,784 KB
testcase_07 AC 622 ms
18,948 KB
testcase_08 AC 620 ms
18,980 KB
testcase_09 AC 103 ms
8,836 KB
testcase_10 AC 106 ms
8,820 KB
testcase_11 AC 103 ms
8,628 KB
testcase_12 AC 106 ms
8,860 KB
testcase_13 AC 107 ms
8,732 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 26 ms
8,668 KB
testcase_22 AC 21 ms
8,640 KB
testcase_23 AC 28 ms
8,668 KB
testcase_24 AC 29 ms
8,572 KB
testcase_25 AC 28 ms
8,664 KB
testcase_26 AC 19 ms
8,676 KB
testcase_27 AC 19 ms
8,564 KB
testcase_28 AC 19 ms
8,456 KB
testcase_29 WA -
testcase_30 AC 19 ms
8,612 KB
testcase_31 AC 20 ms
8,512 KB
testcase_32 AC 21 ms
8,660 KB
testcase_33 AC 19 ms
8,636 KB
testcase_34 AC 27 ms
8,496 KB
testcase_35 AC 110 ms
10,332 KB
testcase_36 AC 109 ms
10,232 KB
testcase_37 AC 73 ms
9,436 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 749 ms
28,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

def check(word):
    flg = True
    mi, mx = 25, 0
    for s in word:
        if s < mx:
            flg = False
        mi = min(mi, s)
        mx = max(mx, s)
    return (flg, mi, mx, len(S))

lis = []

for i in range(N):
    S = [ord(x)-97 for x in input()]
    ok, mi, mx, ln = check(S)
    if ok:
        lis.append([mi, mx, ln])

lis.sort()
from collections import defaultdict

ans = 0
dp = [0] * 26
for mi, mx, leng in lis:
    if mi == mx:
        dp[mx] += leng
    else:
        dp[mx] = max(dp[mx], max(dp[:mi+1]) + leng)

print(max(dp))
0