結果

問題 No.390 最長の数列
ユーザー hiyokko2
提出日時 2016-07-30 14:09:20
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 3,037 ms / 5,000 ms
コード長 285 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 24,464 KB
最終ジャッジ日時 2024-10-02 11:55:00
合計ジャッジ時間 7,384 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
x = sorted(map(int, input().split()))

maxx = x[-1]
dp = [0] * (maxx + 1)

for i in x:
    dp[i] = 1

for i in x:
    for j in range(i * 2, maxx + 1, i):
        if dp[j] == 0:
            continue
        else:
            dp[j] = max(dp[j], dp[i] + 1)
print(max(dp))
0