結果

問題 No.979 Longest Divisor Sequence
ユーザー kumatan400kumatan400
提出日時 2023-02-27 00:51:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,362 ms / 2,000 ms
コード長 310 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 87,028 KB
実行使用メモリ 235,668 KB
最終ジャッジ日時 2023-10-12 14:11:03
合計ジャッジ時間 20,672 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,050 ms
177,780 KB
testcase_01 AC 1,037 ms
177,900 KB
testcase_02 AC 1,032 ms
178,100 KB
testcase_03 AC 1,038 ms
177,740 KB
testcase_04 AC 1,008 ms
177,956 KB
testcase_05 AC 1,059 ms
177,960 KB
testcase_06 AC 1,042 ms
177,736 KB
testcase_07 AC 1,072 ms
177,856 KB
testcase_08 AC 1,068 ms
177,860 KB
testcase_09 AC 1,085 ms
177,752 KB
testcase_10 AC 1,062 ms
177,828 KB
testcase_11 AC 1,071 ms
185,088 KB
testcase_12 AC 1,055 ms
178,036 KB
testcase_13 AC 1,087 ms
230,612 KB
testcase_14 AC 1,362 ms
235,668 KB
testcase_15 AC 1,099 ms
198,692 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

Z = 3*10**5
R = [[0] for _ in range(Z+1)]
for i in range(1, Z+1):
    for j in range(i+i, Z+1, i):
        R[j].append(i)

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

inf = float("inf")
dp = [-inf] * (Z+1)
dp[0] = 0
for a in A:
    for d in R[a]:
        dp[a] = max(dp[a], dp[d] + 1)

print(max(dp))
0