結果

問題 No.979 Longest Divisor Sequence
ユーザー vwxyzvwxyz
提出日時 2024-04-19 23:24:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 324 bytes
コンパイル時間 845 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 22,996 KB
最終ジャッジ日時 2024-04-19 23:25:06
合計ジャッジ時間 6,495 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
17,692 KB
testcase_01 WA -
testcase_02 AC 210 ms
10,752 KB
testcase_03 AC 75 ms
10,624 KB
testcase_04 AC 329 ms
10,752 KB
testcase_05 AC 142 ms
10,624 KB
testcase_06 AC 150 ms
10,752 KB
testcase_07 AC 164 ms
10,752 KB
testcase_08 AC 272 ms
10,624 KB
testcase_09 AC 139 ms
10,624 KB
testcase_10 AC 40 ms
11,264 KB
testcase_11 AC 50 ms
11,392 KB
testcase_12 AC 39 ms
11,264 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
import sys
readline=sys.stdin.readline

N=int(readline())
X=list(map(int,readline().split()))
set_X=set(X)
dp=defaultdict(int)
for x in X:
    dp[x]=max(dp[x],1)
    for y in range(2*x,10**6+1,x):
        if y in set_X:
            dp[y]=max(dp[y],dp[x]+1)
ans=max(dp.values())
print(ans)
0