結果

問題 No.390 最長の数列
ユーザー tookunn_1213
提出日時 2016-07-09 17:03:46
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 2,720 ms / 5,000 ms
コード長 299 bytes
コンパイル時間 76 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 24,460 KB
最終ジャッジ日時 2024-10-02 10:41:24
合計ジャッジ時間 7,602 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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