結果
| 問題 |
No.1512 作文
|
| コンテスト | |
| ユーザー |
brthyyjp
|
| 提出日時 | 2021-05-21 21:27:58 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 498 ms / 2,000 ms |
| コード長 | 409 bytes |
| コンパイル時間 | 263 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 111,928 KB |
| 最終ジャッジ日時 | 2024-10-10 07:43:09 |
| 合計ジャッジ時間 | 6,355 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 38 |
ソースコード
import sys
import io, os
input = sys.stdin.readline
n = int(input())
S = [input().rstrip() for i in range(n)]
X = [0]*26
T = []
for s in S:
temp = []
for c in s:
temp.append(ord(c)-ord('a'))
if sorted(temp) != temp:
continue
T.append((temp[0], temp[-1], len(s)))
if not T:
print(0)
exit()
T.sort()
for p, q, l in T:
X[q] = max(X[q], max(X[0:p+1])+l)
print(max(X))
brthyyjp