結果

問題 No.979 Longest Divisor Sequence
ユーザー kumatan400kumatan400
提出日時 2022-12-10 02:05:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,155 ms / 2,000 ms
コード長 294 bytes
コンパイル時間 135 ms
コンパイル使用メモリ 82,408 KB
実行使用メモリ 221,036 KB
最終ジャッジ日時 2024-04-22 23:35:44
合計ジャッジ時間 15,140 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 780 ms
174,516 KB
testcase_01 AC 787 ms
174,860 KB
testcase_02 AC 765 ms
174,720 KB
testcase_03 AC 788 ms
175,104 KB
testcase_04 AC 768 ms
174,672 KB
testcase_05 AC 788 ms
174,728 KB
testcase_06 AC 809 ms
174,528 KB
testcase_07 AC 800 ms
174,844 KB
testcase_08 AC 739 ms
174,724 KB
testcase_09 AC 837 ms
174,840 KB
testcase_10 AC 791 ms
174,992 KB
testcase_11 AC 820 ms
174,892 KB
testcase_12 AC 781 ms
174,924 KB
testcase_13 AC 909 ms
209,504 KB
testcase_14 AC 1,155 ms
221,036 KB
testcase_15 AC 926 ms
189,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

Z = 3 * 10**5

P = [[1] for _ in range(Z+1)]
P[1] = [0]

for i in range(2, Z+1):
    for j in range(i+i, Z+1, i):
        P[j].append(i)

X = [0] * (Z+1)

N = int(input())
A = list(map(int, input().split()))
for a in A:
    t = max(X[i] for i in P[a])
    X[a] = max(X[a], t + 1)

print(max(X))
0