結果

問題 No.1512 作文
ユーザー wolgnikwolgnik
提出日時 2021-05-21 21:33:22
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 304 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 102,480 KB
最終ジャッジ日時 2024-04-18 14:42:52
合計ジャッジ時間 4,529 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 40 ms
51,712 KB
testcase_02 AC 39 ms
51,200 KB
testcase_03 AC 40 ms
51,712 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 70 ms
66,688 KB
testcase_10 AC 77 ms
66,944 KB
testcase_11 AC 71 ms
66,560 KB
testcase_12 AC 76 ms
66,944 KB
testcase_13 AC 68 ms
67,072 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 41 ms
52,864 KB
testcase_22 AC 42 ms
52,480 KB
testcase_23 AC 37 ms
53,760 KB
testcase_24 AC 39 ms
53,632 KB
testcase_25 WA -
testcase_26 AC 37 ms
51,328 KB
testcase_27 AC 34 ms
51,584 KB
testcase_28 AC 35 ms
52,096 KB
testcase_29 AC 36 ms
51,328 KB
testcase_30 AC 34 ms
51,440 KB
testcase_31 AC 40 ms
57,472 KB
testcase_32 AC 37 ms
57,856 KB
testcase_33 AC 38 ms
56,960 KB
testcase_34 AC 41 ms
60,288 KB
testcase_35 AC 65 ms
83,840 KB
testcase_36 AC 63 ms
83,964 KB
testcase_37 AC 48 ms
72,448 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 238 ms
102,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
N = int(input())
a = []
for _ in range(N):
  S = list(input())[: -1]
  if sorted(S) == S: a.append(S)

dp = [0] * 26

for S in a:
  l = ord(min(S)) - ord("a")
  r = ord(max(S)) - ord("a")
  for i in range(l, -1, -1): dp[r] = max(dp[r], dp[i] + len(S))
print(max(dp))
0