結果

問題 No.979 Longest Divisor Sequence
ユーザー titiatitia
提出日時 2020-01-31 22:13:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 299 bytes
コンパイル時間 1,181 ms
コンパイル使用メモリ 81,604 KB
実行使用メモリ 119,172 KB
最終ジャッジ日時 2023-10-17 10:04:57
合計ジャッジ時間 5,017 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,576 KB
testcase_01 AC 37 ms
53,576 KB
testcase_02 WA -
testcase_03 AC 35 ms
53,576 KB
testcase_04 WA -
testcase_05 AC 35 ms
53,576 KB
testcase_06 AC 36 ms
53,576 KB
testcase_07 AC 36 ms
53,576 KB
testcase_08 AC 36 ms
53,576 KB
testcase_09 AC 35 ms
53,576 KB
testcase_10 AC 73 ms
67,124 KB
testcase_11 AC 67 ms
65,104 KB
testcase_12 AC 70 ms
67,176 KB
testcase_13 WA -
testcase_14 AC 1,801 ms
112,768 KB
testcase_15 AC 643 ms
91,492 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))

    MAX=DP[1]
    for i in range(2,xr+1):
        if x%i==0:
            MAX=max(MAX,DP[i],DP[x//i])

    DP[x]=MAX+1

print(max(DP))
0