結果

問題 No.2218 Multiple LIS
ユーザー FromBooskaFromBooska
提出日時 2023-02-25 16:07:35
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 545 bytes
コンパイル時間 1,591 ms
コンパイル使用メモリ 86,772 KB
実行使用メモリ 834,732 KB
最終ジャッジ日時 2023-10-11 13:55:58
合計ジャッジ時間 6,533 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,388 KB
testcase_01 AC 73 ms
71,504 KB
testcase_02 AC 73 ms
71,392 KB
testcase_03 AC 74 ms
71,316 KB
testcase_04 AC 72 ms
71,296 KB
testcase_05 AC 73 ms
71,344 KB
testcase_06 AC 72 ms
71,336 KB
testcase_07 AC 72 ms
71,324 KB
testcase_08 AC 71 ms
71,444 KB
testcase_09 AC 73 ms
71,256 KB
testcase_10 AC 73 ms
71,392 KB
testcase_11 AC 83 ms
75,908 KB
testcase_12 AC 84 ms
76,396 KB
testcase_13 AC 83 ms
76,524 KB
testcase_14 AC 83 ms
76,400 KB
testcase_15 AC 84 ms
76,488 KB
testcase_16 AC 77 ms
76,148 KB
testcase_17 AC 85 ms
76,344 KB
testcase_18 AC 78 ms
75,840 KB
testcase_19 AC 78 ms
76,164 KB
testcase_20 AC 83 ms
76,400 KB
testcase_21 MLE -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# 解き方が一見わからないときはdpを疑うべき
# 制約がdp内であればdpを疑うべき
# dp[i番目までを見て][最後の選んだ数がjのときの]最大連結数

N = int(input())
A = list(map(int, input().split()))

maxA = max(A)
dp = [[0]*(maxA+1) for i in range(N+1)]

for i in range(1, N+1):
    num = A[i-1]
    mx = 0
    for j in range(1, maxA+1):
        dp[i][j] = dp[i-1][j]
        if num%j == 0:
            mx = max(mx, dp[i-1][j])
    dp[i][num] = mx+1
    #print(dp[i])

ans = max(dp[N])
print(ans)


0