結果

問題 No.979 Longest Divisor Sequence
ユーザー titiatitia
提出日時 2020-01-31 22:09:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,865 ms / 2,000 ms
コード長 391 bytes
コンパイル時間 920 ms
コンパイル使用メモリ 81,644 KB
実行使用メモリ 121,328 KB
最終ジャッジ日時 2023-10-17 09:58:16
合計ジャッジ時間 4,395 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,540 KB
testcase_01 AC 39 ms
53,540 KB
testcase_02 AC 38 ms
53,540 KB
testcase_03 AC 37 ms
53,540 KB
testcase_04 AC 38 ms
53,540 KB
testcase_05 AC 38 ms
53,540 KB
testcase_06 AC 39 ms
53,540 KB
testcase_07 AC 38 ms
53,540 KB
testcase_08 AC 38 ms
53,540 KB
testcase_09 AC 38 ms
53,540 KB
testcase_10 AC 87 ms
71,240 KB
testcase_11 AC 76 ms
69,168 KB
testcase_12 AC 81 ms
71,244 KB
testcase_13 AC 112 ms
121,328 KB
testcase_14 AC 1,865 ms
112,836 KB
testcase_15 AC 700 ms
91,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
import math 

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

DP=[0]*(max(A)+1)

for x in (A):
    xr=math.ceil(math.sqrt(x))

    LIST=[]
    for i in range(1,xr+1):
        if x%i==0:
            LIST.append(i)
            LIST.append(x//i)

    MAX=0
    for i in LIST:
        if i!=x:
            MAX=max(MAX,DP[i])
    DP[x]=MAX+1

print(max(DP))
0