結果
| 問題 | 
                            No.1512 作文
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-05-22 11:36:58 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 269 bytes | 
| コンパイル時間 | 93 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 37,428 KB | 
| 最終ジャッジ日時 | 2024-10-10 10:53:01 | 
| 合計ジャッジ時間 | 7,136 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 34 WA * 4 | 
ソースコード
N = int(input())
S = []
for _ in range(N):
    s = input()
    l = list(s)
    if l == sorted(l):
        S.append(s)
        
S.sort(key=lambda x: (x[-1]+x[0], -len(x)))
ans = 0
t = 'a'
for s in S:
    if t <= s[0]:
        ans += len(s)
        t = s[-1]
print(ans)