結果

問題 No.390 最長の数列
ユーザー tookunn_1213tookunn_1213
提出日時 2016-07-09 18:24:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 3,033 ms / 5,000 ms
コード長 252 bytes
コンパイル時間 126 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 24,600 KB
最終ジャッジ日時 2024-04-10 08:59:34
合計ジャッジ時間 7,321 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 29 ms
10,880 KB
testcase_02 AC 29 ms
10,752 KB
testcase_03 AC 29 ms
10,752 KB
testcase_04 AC 29 ms
10,752 KB
testcase_05 AC 187 ms
24,600 KB
testcase_06 AC 3,033 ms
24,288 KB
testcase_07 AC 28 ms
10,752 KB
testcase_08 AC 57 ms
18,508 KB
testcase_09 AC 171 ms
18,592 KB
testcase_10 AC 414 ms
24,476 KB
testcase_11 AC 434 ms
24,536 KB
testcase_12 AC 415 ms
24,460 KB
testcase_13 AC 502 ms
23,344 KB
testcase_14 AC 762 ms
20,652 KB
testcase_15 AC 30 ms
10,880 KB
testcase_16 AC 58 ms
18,512 KB
testcase_17 AC 68 ms
18,980 KB
testcase_18 AC 77 ms
19,220 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
x = sorted(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(N):
	for j in range(x[i] * 2,M,x[i]):
		if dp[j] == 0:
			continue
		dp[j] = max(dp[j],dp[x[i]] + 1)
print (max(dp))
0