結果

問題 No.390 最長の数列
ユーザー tookunn_1213
提出日時 2016-07-09 17:04:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 221 ms / 5,000 ms
コード長 299 bytes
コンパイル時間 390 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 93,824 KB
最終ジャッジ日時 2024-10-02 10:41:30
合計ジャッジ時間 2,653 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
x = sorted([int(i) for i in input().split()])
M = max(x) + 1
dp = [0] * M
ans = 0
for i in range(N):
	dp[x[i]] = 1
for i in range(M):
	if dp[i] == 0:
		continue
	for j in range(i + i,M,i):
		if dp[j] == 0:
			continue
		dp[j] = max(dp[j],dp[i] + 1)
	ans = max(ans,dp[i])
print (ans)
0