結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 29 ms
10,752 KB
testcase_03 AC 30 ms
10,752 KB
testcase_04 AC 30 ms
10,880 KB
testcase_05 AC 182 ms
24,852 KB
testcase_06 AC 3,082 ms
25,096 KB
testcase_07 AC 29 ms
10,752 KB
testcase_08 AC 58 ms
18,500 KB
testcase_09 AC 168 ms
18,500 KB
testcase_10 AC 404 ms
25,128 KB
testcase_11 AC 439 ms
25,192 KB
testcase_12 AC 434 ms
25,184 KB
testcase_13 AC 563 ms
24,344 KB
testcase_14 AC 743 ms
23,468 KB
testcase_15 AC 30 ms
11,008 KB
testcase_16 AC 59 ms
18,512 KB
testcase_17 AC 70 ms
18,924 KB
testcase_18 AC 75 ms
19,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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