結果

問題 No.390 最長の数列
コンテスト
ユーザー matsu7874
提出日時 2016-07-11 00:21:59
言語 Python3
(3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
TLE  
実行時間 -
コード長 397 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 55 ms
コンパイル使用メモリ 15,104 KB
実行使用メモリ 25,412 KB
最終ジャッジ日時 2026-09-15 15:11:53
合計ジャッジ時間 9,555 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 1 TLE * 1 -- * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def get_divisor(n):
    divisor = set()
    divisor.add(1)
    for i in range(1, n//2+1):
        if n % i == 0:
            divisor.add(i)
            divisor.add(n//i)
    return list(divisor)

n = int(input())
x = list(map(int, input().split()))
x.sort()
length = [0 for i in range(max(x)+1)]
for e in x:
    length[e] = max(length[e], *[length[d]+1 for d in get_divisor(e)])
print(max(length))
0