結果

問題 No.390 最長の数列
ユーザー titiatitia
提出日時 2023-02-02 02:16:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 3,169 ms / 5,000 ms
コード長 271 bytes
コンパイル時間 488 ms
コンパイル使用メモリ 10,664 KB
実行使用メモリ 30,188 KB
最終ジャッジ日時 2023-09-14 11:39:39
合計ジャッジ時間 11,844 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 366 ms
23,532 KB
testcase_01 AC 237 ms
23,760 KB
testcase_02 AC 332 ms
23,564 KB
testcase_03 AC 255 ms
23,772 KB
testcase_04 AC 335 ms
23,644 KB
testcase_05 AC 206 ms
29,836 KB
testcase_06 AC 3,169 ms
29,816 KB
testcase_07 AC 241 ms
23,548 KB
testcase_08 AC 146 ms
23,472 KB
testcase_09 AC 240 ms
23,504 KB
testcase_10 AC 430 ms
29,860 KB
testcase_11 AC 451 ms
29,764 KB
testcase_12 AC 437 ms
29,908 KB
testcase_13 AC 521 ms
29,740 KB
testcase_14 AC 2,251 ms
30,188 KB
testcase_15 AC 148 ms
23,592 KB
testcase_16 AC 149 ms
23,484 KB
testcase_17 AC 154 ms
24,288 KB
testcase_18 AC 166 ms
24,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

X=[0]*(10**6+1)

for a in A:
    X[a]=1

DP=[1]*(10**6+1)

for i in range(1,10**6+1):
    if X[i]==1:
        for j in range(i+i,10**6+1,i):
            if X[j]==1:
                DP[j]=max(DP[i]+1,DP[j])

print(max(DP))
0