結果

問題 No.1512 作文
ユーザー otsunekootsuneko
提出日時 2021-05-21 22:00:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 471 bytes
コンパイル時間 562 ms
コンパイル使用メモリ 81,964 KB
実行使用メモリ 171,224 KB
最終ジャッジ日時 2024-04-18 15:26:49
合計ジャッジ時間 7,243 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
53,156 KB
testcase_01 AC 39 ms
53,004 KB
testcase_02 AC 39 ms
53,212 KB
testcase_03 AC 39 ms
52,612 KB
testcase_04 AC 438 ms
123,316 KB
testcase_05 AC 446 ms
123,580 KB
testcase_06 AC 424 ms
123,640 KB
testcase_07 AC 437 ms
123,380 KB
testcase_08 AC 433 ms
123,812 KB
testcase_09 AC 40 ms
53,368 KB
testcase_10 AC 41 ms
54,428 KB
testcase_11 AC 40 ms
54,264 KB
testcase_12 AC 41 ms
53,700 KB
testcase_13 AC 40 ms
54,400 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 39 ms
54,440 KB
testcase_22 AC 39 ms
52,552 KB
testcase_23 AC 40 ms
54,556 KB
testcase_24 AC 39 ms
53,756 KB
testcase_25 AC 39 ms
53,348 KB
testcase_26 AC 40 ms
52,896 KB
testcase_27 AC 40 ms
53,024 KB
testcase_28 AC 39 ms
52,692 KB
testcase_29 AC 39 ms
53,172 KB
testcase_30 AC 40 ms
52,828 KB
testcase_31 WA -
testcase_32 AC 49 ms
58,764 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 49 ms
73,104 KB
testcase_36 AC 50 ms
73,396 KB
testcase_37 AC 45 ms
66,976 KB
testcase_38 AC 50 ms
72,212 KB
testcase_39 AC 52 ms
73,732 KB
testcase_40 AC 627 ms
171,224 KB
testcase_41 AC 309 ms
144,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from operator import itemgetter
import sys
input = lambda: sys.stdin.readline().rstrip()
#INF = 10**18

N = int(input())
l = []
for i in range(N):
    S = input()
    for i in range(len(S)-1):
        if S[i] > S[i+1]:
            break
    else:
        l.append([S[0],S[-1],-len(S),S])
l.sort(key=itemgetter(0,1,2))

ans = 0
last = "a"
for s in l:
    if s[0] < last:
        continue
    else:
        ans -= s[2]
        last = s[1]
print(ans)
0