結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 29 ms
10,752 KB
testcase_02 AC 30 ms
10,752 KB
testcase_03 AC 30 ms
10,752 KB
testcase_04 AC 30 ms
10,752 KB
testcase_05 AC 250 ms
24,200 KB
testcase_06 AC 3,212 ms
24,408 KB
testcase_07 AC 30 ms
10,880 KB
testcase_08 AC 174 ms
18,484 KB
testcase_09 AC 279 ms
18,548 KB
testcase_10 AC 486 ms
24,336 KB
testcase_11 AC 533 ms
24,212 KB
testcase_12 AC 481 ms
24,252 KB
testcase_13 AC 641 ms
23,244 KB
testcase_14 AC 681 ms
20,652 KB
testcase_15 AC 34 ms
10,880 KB
testcase_16 AC 171 ms
18,452 KB
testcase_17 AC 181 ms
18,924 KB
testcase_18 AC 189 ms
19,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
x =  list(map(int,input().split()))
M = max(x) + 1
dp = [0] * M
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)
print (max(dp))
0