結果

問題 No.390 最長の数列
ユーザー lllllll88938494
提出日時 2022-09-13 12:55:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 551 ms / 5,000 ms
コード長 336 bytes
コンパイル時間 146 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 104,064 KB
最終ジャッジ日時 2024-11-30 16:52:12
合計ジャッジ時間 3,517 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
s=list(map(int,input().split()))
s.sort()
dic={}

for i in range(n):
    dic[s[i]] = i

dp=[1]*n


for i in range(len(dp)-1):

    num=s[i]*2
    while num <= 10**6:
        if num in dic:
            dp[dic[num]] = max(dp[dic[num]],dp[i]+1)
        num+=s[i]
        
print(max(dp))

            
            
    
    
0