結果

問題 No.390 最長の数列
ユーザー tookunn_1213tookunn_1213
提出日時 2016-07-09 18:23:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,984 ms / 5,000 ms
コード長 258 bytes
コンパイル時間 224 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 25,864 KB
最終ジャッジ日時 2024-04-10 08:59:25
合計ジャッジ時間 7,015 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
10,880 KB
testcase_01 AC 25 ms
10,752 KB
testcase_02 AC 25 ms
10,752 KB
testcase_03 AC 27 ms
10,752 KB
testcase_04 AC 29 ms
10,752 KB
testcase_05 AC 150 ms
25,456 KB
testcase_06 AC 2,984 ms
25,284 KB
testcase_07 AC 28 ms
10,752 KB
testcase_08 AC 54 ms
18,420 KB
testcase_09 AC 159 ms
18,556 KB
testcase_10 AC 356 ms
25,448 KB
testcase_11 AC 412 ms
25,524 KB
testcase_12 AC 359 ms
25,332 KB
testcase_13 AC 443 ms
23,476 KB
testcase_14 AC 683 ms
25,864 KB
testcase_15 AC 27 ms
10,880 KB
testcase_16 AC 53 ms
18,436 KB
testcase_17 AC 67 ms
18,748 KB
testcase_18 AC 67 ms
19,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
x =  sorted(list(set(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