結果

問題 No.390 最長の数列
ユーザー ああいい
提出日時 2022-03-30 00:21:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 663 ms / 5,000 ms
コード長 295 bytes
コンパイル時間 555 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 105,984 KB
最終ジャッジ日時 2024-11-08 23:56:15
合計ジャッジ時間 3,975 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

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

d = dict()
for i in x:
    d[i] = 1
C = max(x) + 1
for i in x:
    u = d[i]
    for j in range(2 * i,C,i):
        if j in d:
            d[j] = max(d[j],u + 1)
ans = 0
for v in d.values():
    if v > ans:
        ans = v
print(ans)
0