結果

問題 No.1512 作文
ユーザー wolgnikwolgnik
提出日時 2021-05-21 21:34:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 578 ms / 2,000 ms
コード長 344 bytes
コンパイル時間 323 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 125,904 KB
最終ジャッジ日時 2024-04-18 14:49:45
合計ジャッジ時間 6,366 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,352 KB
testcase_01 AC 36 ms
51,968 KB
testcase_02 AC 35 ms
51,840 KB
testcase_03 AC 36 ms
51,968 KB
testcase_04 AC 424 ms
102,516 KB
testcase_05 AC 421 ms
102,272 KB
testcase_06 AC 422 ms
103,020 KB
testcase_07 AC 420 ms
102,992 KB
testcase_08 AC 431 ms
102,752 KB
testcase_09 AC 68 ms
67,072 KB
testcase_10 AC 72 ms
66,944 KB
testcase_11 AC 69 ms
66,176 KB
testcase_12 AC 76 ms
67,072 KB
testcase_13 AC 70 ms
67,328 KB
testcase_14 AC 82 ms
76,440 KB
testcase_15 AC 79 ms
76,160 KB
testcase_16 AC 83 ms
76,788 KB
testcase_17 AC 83 ms
76,672 KB
testcase_18 AC 81 ms
76,288 KB
testcase_19 AC 84 ms
76,416 KB
testcase_20 AC 81 ms
76,160 KB
testcase_21 AC 36 ms
52,608 KB
testcase_22 AC 36 ms
52,204 KB
testcase_23 AC 39 ms
53,504 KB
testcase_24 AC 42 ms
53,760 KB
testcase_25 AC 38 ms
53,376 KB
testcase_26 AC 35 ms
51,968 KB
testcase_27 AC 34 ms
51,456 KB
testcase_28 AC 39 ms
51,712 KB
testcase_29 AC 35 ms
52,352 KB
testcase_30 AC 35 ms
51,968 KB
testcase_31 AC 39 ms
58,240 KB
testcase_32 AC 39 ms
58,624 KB
testcase_33 AC 40 ms
58,240 KB
testcase_34 AC 44 ms
61,312 KB
testcase_35 AC 68 ms
84,344 KB
testcase_36 AC 70 ms
83,968 KB
testcase_37 AC 50 ms
72,960 KB
testcase_38 AC 67 ms
81,152 KB
testcase_39 AC 67 ms
80,464 KB
testcase_40 AC 578 ms
125,904 KB
testcase_41 AC 347 ms
124,372 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
a.sort(key = lambda x: (max(x), min(x)))
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