結果
| 問題 |
No.1512 作文
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-05-21 22:48:16 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 336 bytes |
| コンパイル時間 | 324 ms |
| コンパイル使用メモリ | 82,376 KB |
| 実行使用メモリ | 77,080 KB |
| 最終ジャッジ日時 | 2024-10-10 09:31:48 |
| 合計ジャッジ時間 | 4,639 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 WA * 17 |
ソースコード
N = int(input())
dp = [0]*26
for i in range(N):
S = input()
now = 0
for s in S:
num = ord(s)-ord('a')
if num<now:
break
now = num
else:
new_dp = dp[:]
for j in range(ord(S[0])-ord('a')+1):
new_dp[ord(S[-1])-ord('a')] = max(new_dp[ord(S[-1])-ord('a')], dp[j]+len(S))
dp = new_dp
print(max(dp))