結果

問題 No.979 Longest Divisor Sequence
ユーザー rin204
提出日時 2022-03-24 17:03:23
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 300 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 82,520 KB
実行使用メモリ 120,012 KB
最終ジャッジ日時 2024-10-13 01:07:18
合計ジャッジ時間 4,394 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))
ma = max(A)
dp = [0] * (ma + 1)

for a in A:
    dp[a] = max(dp[a], dp[1] + 1)
    for i in range(2, int(a ** 0.5 + 1)):
        if a % i == 0:
            dp[a] = max(dp[a], dp[i] + 1)
            dp[a] = max(dp[a], dp[a // i] + 1)
print(max(dp))
0