結果

問題 No.979 Longest Divisor Sequence
ユーザー titiatitia
提出日時 2020-01-31 21:54:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 452 bytes
コンパイル時間 560 ms
コンパイル使用メモリ 11,828 KB
実行使用メモリ 48,888 KB
最終ジャッジ日時 2023-10-17 09:34:18
合計ジャッジ時間 6,479 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,048 KB
testcase_01 AC 30 ms
10,048 KB
testcase_02 AC 31 ms
10,048 KB
testcase_03 AC 31 ms
10,048 KB
testcase_04 AC 31 ms
10,048 KB
testcase_05 AC 30 ms
10,048 KB
testcase_06 AC 29 ms
10,048 KB
testcase_07 AC 30 ms
10,048 KB
testcase_08 AC 30 ms
10,048 KB
testcase_09 AC 30 ms
10,048 KB
testcase_10 AC 652 ms
10,500 KB
testcase_11 AC 667 ms
10,500 KB
testcase_12 AC 671 ms
10,500 KB
testcase_13 AC 111 ms
15,412 KB
testcase_14 TLE -
testcase_15 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

DP=[set() for i in range(18)]
DP[0]={1}

for a in (A):
    if a==1:
        DP[1].add(1)
        continue
    flag=0
    for i in range(17,-1,-1):
        for s in DP[i]:
            if a>s and a%s==0:
                DP[i+1].add(a)
                flag=1
                break
        if flag:
            break

for i in range(17,-1,-1):
    if DP[i]!=set():
        print(i)
        break

        

0