結果

問題 No.979 Longest Divisor Sequence
ユーザー kumatan400kumatan400
提出日時 2021-12-24 06:32:48
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 478 bytes
コンパイル時間 1,296 ms
コンパイル使用メモリ 81,620 KB
実行使用メモリ 202,128 KB
最終ジャッジ日時 2023-10-19 06:55:10
合計ジャッジ時間 34,141 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,865 ms
142,964 KB
testcase_01 AC 1,855 ms
142,964 KB
testcase_02 AC 1,870 ms
142,960 KB
testcase_03 AC 1,864 ms
142,968 KB
testcase_04 AC 1,869 ms
142,960 KB
testcase_05 AC 1,868 ms
142,956 KB
testcase_06 AC 1,868 ms
142,964 KB
testcase_07 AC 1,861 ms
142,964 KB
testcase_08 AC 1,862 ms
142,964 KB
testcase_09 AC 1,867 ms
142,960 KB
testcase_10 AC 1,899 ms
146,220 KB
testcase_11 AC 1,886 ms
143,456 KB
testcase_12 AC 1,890 ms
146,196 KB
testcase_13 AC 1,971 ms
191,688 KB
testcase_14 TLE -
testcase_15 AC 1,988 ms
157,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def d(K):
    res = []
    i = 1
    while i * i <= K:
        if K % i == 0:
            if i != K:
                res.append(i)
            j = K // i
            if i != j and j != K:
                res.append(j)
        i += 1
    return res

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

L = [0] * (Z+1)


N = int(input())
A = list(map(int, input().split()))
for a in A:
    M = max(L[r] for r in R[a])
    L[a] = M + 1


ans = max(L)
print(ans)
0