結果

問題 No.390 最長の数列
コンテスト
ユーザー tookunn_1213
提出日時 2016-07-09 00:17:05
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 366 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 379 ms
コンパイル使用メモリ 20,700 KB
実行使用メモリ 43,832 KB
最終ジャッジ日時 2026-04-30 16:31:24
合計ジャッジ時間 7,796 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 2
other WA * 1 TLE * 1 -- * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N = int(input())
x = sorted([int(i) for i in input().split()])
dp = [0 for i in range(max(x) + 1)]
a = [False for i in range(max(x) + 1)]
for i in range(N):
	a[x[i]] = True
for i in range(N):
	dp[x[i]] = max(dp[x[i]],1)
	for j in range(2,max(x) + 1):
		if x[i] * j >= max(x):
			break
		if a[x[i] * j]:
			dp[x[i] * j] = max(dp[x[i] * j],dp[x[i]] + 1)
print(max(dp))
0