結果

問題 No.390 最長の数列
ユーザー nebukuro09
提出日時 2016-10-15 10:00:19
言語 Python2
(2.7.18)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 291 bytes
コンパイル時間 60 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 41,456 KB
最終ジャッジ日時 2024-11-22 11:19:52
合計ジャッジ時間 13,744 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 14 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

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

m = max(x)
dp = [float('-inf') for _ in xrange(m+1)]
for a in x:
    dp[a] = 1

for a in x:
    b = a*2
    c = dp[a]
    while b <= m:
        if dp[b] != float('-inf'):
            dp[b] = max(c+1, dp[b])
        b += a

print max(dp)
0