結果

問題 No.1512 作文
ユーザー tassei903tassei903
提出日時 2021-05-21 22:24:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 561 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 102,764 KB
最終ジャッジ日時 2024-04-18 15:57:32
合計ジャッジ時間 17,554 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
17,696 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 28 ms
10,752 KB
testcase_03 AC 29 ms
10,880 KB
testcase_04 TLE -
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 AC 29 ms
11,008 KB
testcase_10 AC 30 ms
11,008 KB
testcase_11 AC 29 ms
11,136 KB
testcase_12 AC 29 ms
11,008 KB
testcase_13 AC 30 ms
11,008 KB
testcase_14 AC 113 ms
12,800 KB
testcase_15 AC 109 ms
12,800 KB
testcase_16 AC 113 ms
12,928 KB
testcase_17 AC 111 ms
12,800 KB
testcase_18 AC 114 ms
12,800 KB
testcase_19 AC 109 ms
12,928 KB
testcase_20 AC 109 ms
12,800 KB
testcase_21 AC 29 ms
10,880 KB
testcase_22 AC 30 ms
10,752 KB
testcase_23 AC 30 ms
11,008 KB
testcase_24 AC 30 ms
10,880 KB
testcase_25 AC 29 ms
10,880 KB
testcase_26 AC 29 ms
10,752 KB
testcase_27 AC 29 ms
10,752 KB
testcase_28 AC 28 ms
10,752 KB
testcase_29 AC 29 ms
10,752 KB
testcase_30 AC 29 ms
10,752 KB
testcase_31 AC 30 ms
10,752 KB
testcase_32 AC 30 ms
10,880 KB
testcase_33 AC 30 ms
10,752 KB
testcase_34 AC 35 ms
10,880 KB
testcase_35 AC 87 ms
11,264 KB
testcase_36 AC 87 ms
11,264 KB
testcase_37 AC 64 ms
11,008 KB
testcase_38 AC 91 ms
11,008 KB
testcase_39 AC 93 ms
11,008 KB
testcase_40 TLE -
testcase_41 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = [input() for i in range(n)]

z = []
for i in range(n):
    b = True
    for j in range(len(s[i])-1):
        if s[i][j] > s[i][j+1]:
            b = False
            break
    if b:
        z.append((ord(s[i][0])-97,ord(s[i][-1])-97,len(s[i])))

z = sorted(z,key = lambda x:(x[1],x[0]))
m = len(z)
dp = [[0 for i in range(26)] for j in range(m+1)]
for i in range(m):
    for j in range(26):
        dp[i+1][j] = dp[i][j]
    for j in range(0,z[i][0]+1):
        dp[i+1][z[i][1]] = max(dp[i+1][z[i][1]],dp[i][j]+z[i][2])
print(max(dp[-1]))
0