結果

問題 No.1512 作文
ユーザー irumo8202
提出日時 2022-02-13 15:46:53
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 501 bytes
コンパイル時間 190 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 46,856 KB
最終ジャッジ日時 2024-06-29 05:38:47
合計ジャッジ時間 8,795 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 34 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

def check(word):
    flg = True
    mi, mx = 'z', 'a'
    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 = input()
    ok, mi, mx, ln = check(S)
    if ok:
        lis.append([mi, mx, ln])

lis.sort(key=lambda x: (x[1], x[0], -x[2]))

ans = 0
last = 'a'
for mi, mx, leng in lis:
    if last > mi:
        continue
    ans += leng
    last = mx

print(ans)
0