結果

問題 No.390 最長の数列
ユーザー 👑 SPD_9X2
提出日時 2025-08-05 22:16:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 888 ms / 5,000 ms
コード長 290 bytes
コンパイル時間 316 ms
コンパイル使用メモリ 82,468 KB
実行使用メモリ 106,400 KB
最終ジャッジ日時 2025-08-05 22:17:03
合計ジャッジ時間 4,187 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

N = int(input())
a = list(map(int,input().split()))
a.sort()

dic = {}

for k in a:
    dic[k] = 0

for x in a:
    for y in range(2*x,a[-1]+1,x):
        if y in dic:
            dic[y] = max(dic[y],dic[x]+1)

#print (dic)
print (max(dic.values())+1)
0