結果

問題 No.979 Longest Divisor Sequence
ユーザー chineristACchineristAC
提出日時 2020-06-18 02:57:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,301 ms / 2,000 ms
コード長 422 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 86,696 KB
実行使用メモリ 215,320 KB
最終ジャッジ日時 2023-09-16 11:54:03
合計ジャッジ時間 19,565 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 985 ms
168,656 KB
testcase_01 AC 979 ms
168,780 KB
testcase_02 AC 985 ms
168,656 KB
testcase_03 AC 976 ms
168,436 KB
testcase_04 AC 985 ms
168,676 KB
testcase_05 AC 996 ms
168,776 KB
testcase_06 AC 994 ms
168,488 KB
testcase_07 AC 978 ms
168,692 KB
testcase_08 AC 1,002 ms
168,784 KB
testcase_09 AC 997 ms
168,684 KB
testcase_10 AC 999 ms
171,548 KB
testcase_11 AC 996 ms
171,644 KB
testcase_12 AC 989 ms
171,288 KB
testcase_13 AC 1,030 ms
215,320 KB
testcase_14 AC 1,301 ms
207,024 KB
testcase_15 AC 1,075 ms
185,536 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

import sys

input=sys.stdin.buffer.readline

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

data=[0]*(max(A)+1)
for i in range(N):
    test=1
    for D in divisors[A[i]]:
        if D!=A[i]:
            test=max(test,data[D]+1)
    data[A[i]]=max(data[A[i]],test)

print(max(data))
0