結果

問題 No.979 Longest Divisor Sequence
ユーザー kumatan400kumatan400
提出日時 2021-12-24 06:48:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,391 ms / 2,000 ms
コード長 296 bytes
コンパイル時間 227 ms
コンパイル使用メモリ 81,592 KB
実行使用メモリ 185,324 KB
最終ジャッジ日時 2023-10-19 07:18:17
合計ジャッジ時間 19,105 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 991 ms
169,508 KB
testcase_01 AC 1,020 ms
169,504 KB
testcase_02 AC 1,039 ms
169,508 KB
testcase_03 AC 1,035 ms
169,508 KB
testcase_04 AC 1,020 ms
169,504 KB
testcase_05 AC 996 ms
169,508 KB
testcase_06 AC 986 ms
169,512 KB
testcase_07 AC 995 ms
169,508 KB
testcase_08 AC 1,027 ms
169,508 KB
testcase_09 AC 969 ms
169,508 KB
testcase_10 AC 1,015 ms
169,940 KB
testcase_11 AC 1,002 ms
169,900 KB
testcase_12 AC 1,042 ms
169,932 KB
testcase_13 AC 1,115 ms
172,808 KB
testcase_14 AC 1,391 ms
185,324 KB
testcase_15 AC 1,135 ms
171,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

Z = 3 * 10**5
R = [[] 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)
R[1].append(0)


L = [0] * (Z+1)
for a in A:
    M = max(L[r] for r in R[a])
    L[a] = M + 1


ans = max(L)
print(ans)
0