結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,752 KB
testcase_01 AC 29 ms
10,752 KB
testcase_02 AC 29 ms
10,880 KB
testcase_03 AC 31 ms
10,880 KB
testcase_04 AC 30 ms
10,752 KB
testcase_05 AC 239 ms
24,304 KB
testcase_06 AC 3,059 ms
24,216 KB
testcase_07 AC 29 ms
10,752 KB
testcase_08 AC 169 ms
18,480 KB
testcase_09 AC 280 ms
18,564 KB
testcase_10 AC 446 ms
24,248 KB
testcase_11 AC 480 ms
24,184 KB
testcase_12 AC 489 ms
24,180 KB
testcase_13 AC 582 ms
23,368 KB
testcase_14 AC 677 ms
20,728 KB
testcase_15 AC 31 ms
10,880 KB
testcase_16 AC 166 ms
18,612 KB
testcase_17 AC 176 ms
18,888 KB
testcase_18 AC 187 ms
19,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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