結果

問題 No.390 最長の数列
ユーザー tookunn_1213tookunn_1213
提出日時 2016-07-09 17:03:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 3,153 ms / 5,000 ms
コード長 299 bytes
コンパイル時間 234 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 24,572 KB
最終ジャッジ日時 2024-04-10 08:57:12
合計ジャッジ時間 8,495 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,752 KB
testcase_01 AC 28 ms
10,880 KB
testcase_02 AC 28 ms
10,880 KB
testcase_03 AC 28 ms
10,752 KB
testcase_04 AC 29 ms
10,880 KB
testcase_05 AC 297 ms
24,504 KB
testcase_06 AC 3,153 ms
24,064 KB
testcase_07 AC 28 ms
10,752 KB
testcase_08 AC 142 ms
18,604 KB
testcase_09 AC 262 ms
18,492 KB
testcase_10 AC 479 ms
24,432 KB
testcase_11 AC 582 ms
24,548 KB
testcase_12 AC 515 ms
24,572 KB
testcase_13 AC 636 ms
23,352 KB
testcase_14 AC 715 ms
20,612 KB
testcase_15 AC 32 ms
10,880 KB
testcase_16 AC 148 ms
18,328 KB
testcase_17 AC 160 ms
18,904 KB
testcase_18 AC 169 ms
19,224 KB
権限があれば一括ダウンロードができます

ソースコード

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