結果

問題 No.2218 Multiple LIS
ユーザー FromBooskaFromBooska
提出日時 2023-02-25 16:09:44
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 477 bytes
コンパイル時間 1,119 ms
コンパイル使用メモリ 87,068 KB
実行使用メモリ 76,544 KB
最終ジャッジ日時 2023-10-11 13:57:38
合計ジャッジ時間 8,780 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,480 KB
testcase_01 AC 74 ms
71,192 KB
testcase_02 AC 73 ms
71,476 KB
testcase_03 AC 73 ms
71,196 KB
testcase_04 AC 72 ms
71,436 KB
testcase_05 AC 72 ms
71,304 KB
testcase_06 AC 74 ms
71,424 KB
testcase_07 AC 76 ms
71,320 KB
testcase_08 AC 73 ms
71,416 KB
testcase_09 AC 72 ms
71,284 KB
testcase_10 AC 74 ms
71,052 KB
testcase_11 AC 79 ms
75,848 KB
testcase_12 AC 82 ms
76,544 KB
testcase_13 AC 83 ms
76,200 KB
testcase_14 AC 84 ms
76,420 KB
testcase_15 AC 81 ms
76,064 KB
testcase_16 AC 80 ms
75,884 KB
testcase_17 AC 84 ms
76,428 KB
testcase_18 AC 77 ms
75,640 KB
testcase_19 AC 79 ms
75,896 KB
testcase_20 AC 82 ms
76,144 KB
testcase_21 TLE -
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(1, N+1):
    num = A[i-1]
    mx = 0
    for j in range(1, maxA+1):
        if num%j == 0:
            mx = max(mx, dp[j])
    dp[num] = mx+1
    #print(dp)

ans = max(dp)
print(ans)
0