結果

問題 No.979 Longest Divisor Sequence
ユーザー kumatan400kumatan400
提出日時 2022-07-15 19:20:00
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 370 bytes
コンパイル時間 873 ms
コンパイル使用メモリ 86,828 KB
実行使用メモリ 122,896 KB
最終ジャッジ日時 2023-09-09 21:48:33
合計ジャッジ時間 4,042 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,396 KB
testcase_01 RE -
testcase_02 AC 70 ms
71,028 KB
testcase_03 RE -
testcase_04 AC 70 ms
71,272 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 AC 126 ms
122,896 KB
testcase_14 RE -
testcase_15 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

Z = 3*10**5
Z = 10
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