結果

問題 No.2218 Multiple LIS
ユーザー FromBooskaFromBooska
提出日時 2023-02-25 16:11:15
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 479 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 87,184 KB
実行使用メモリ 148,564 KB
最終ジャッジ日時 2023-10-11 13:58:43
合計ジャッジ時間 7,041 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
148,564 KB
testcase_01 AC 75 ms
71,376 KB
testcase_02 AC 75 ms
71,264 KB
testcase_03 AC 74 ms
71,412 KB
testcase_04 AC 74 ms
71,348 KB
testcase_05 AC 73 ms
71,448 KB
testcase_06 AC 73 ms
71,092 KB
testcase_07 AC 71 ms
71,408 KB
testcase_08 AC 74 ms
71,300 KB
testcase_09 AC 73 ms
71,452 KB
testcase_10 AC 72 ms
71,136 KB
testcase_11 AC 77 ms
75,660 KB
testcase_12 AC 80 ms
75,876 KB
testcase_13 AC 82 ms
76,360 KB
testcase_14 AC 80 ms
76,156 KB
testcase_15 AC 80 ms
76,408 KB
testcase_16 AC 77 ms
75,752 KB
testcase_17 AC 83 ms
76,368 KB
testcase_18 AC 78 ms
75,840 KB
testcase_19 AC 78 ms
75,864 KB
testcase_20 AC 81 ms
76,436 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, num+1):
        if num%j == 0:
            mx = max(mx, dp[j])
    dp[num] = mx+1
    #print(dp)

ans = max(dp)
print(ans)



0