結果

問題 No.979 Longest Divisor Sequence
ユーザー kumatan400kumatan400
提出日時 2022-07-15 19:20:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,035 ms / 2,000 ms
コード長 363 bytes
コンパイル時間 306 ms
コンパイル使用メモリ 87,016 KB
実行使用メモリ 191,396 KB
最終ジャッジ日時 2023-09-09 21:49:17
合計ジャッジ時間 15,583 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 856 ms
171,884 KB
testcase_01 AC 881 ms
171,956 KB
testcase_02 AC 831 ms
171,576 KB
testcase_03 AC 829 ms
171,880 KB
testcase_04 AC 837 ms
171,772 KB
testcase_05 AC 803 ms
171,960 KB
testcase_06 AC 802 ms
171,836 KB
testcase_07 AC 807 ms
171,960 KB
testcase_08 AC 795 ms
171,732 KB
testcase_09 AC 779 ms
171,736 KB
testcase_10 AC 841 ms
171,344 KB
testcase_11 AC 804 ms
171,636 KB
testcase_12 AC 833 ms
171,668 KB
testcase_13 AC 866 ms
165,556 KB
testcase_14 AC 1,035 ms
191,396 KB
testcase_15 AC 848 ms
169,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

ans = 0
X = [0] * (Z + 1)
for a in A:
    M = 0
    for d in D[a]:
        if d == a:
            continue
        M = max(M, X[d])
    M += 1
    ans = max(ans, M)
    X[a] = M

print(ans)
0