結果
問題 |
No.1512 作文
|
ユーザー |
![]() |
提出日時 | 2021-05-21 21:26:35 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 510 bytes |
コンパイル時間 | 378 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 104,600 KB |
最終ジャッジ日時 | 2024-10-10 07:40:36 |
合計ジャッジ時間 | 5,791 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 19 WA * 19 |
ソースコード
import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) N = int(input()) cand = [] for _ in range(N): S = [ord(s) - 97 for s in input().rstrip()] L = len(S) ok = True for i in range(L-1): if S[i] > S[i+1]: ok = False break if not ok: continue cand.append((S[0], S[-1], L)) cand.sort() dp = [0] * 26 for s, t, l in cand: ndp = [0] * 26 for x in range(s+1): ndp[t] = max(ndp[t], dp[x] + l) dp = ndp print(max(dp))