結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
10,752 KB
testcase_01 AC 26 ms
10,752 KB
testcase_02 AC 29 ms
10,880 KB
testcase_03 AC 25 ms
10,752 KB
testcase_04 AC 26 ms
10,752 KB
testcase_05 AC 182 ms
24,644 KB
testcase_06 AC 2,855 ms
24,240 KB
testcase_07 AC 27 ms
10,752 KB
testcase_08 AC 34 ms
18,476 KB
testcase_09 AC 131 ms
18,364 KB
testcase_10 AC 346 ms
24,544 KB
testcase_11 AC 384 ms
24,524 KB
testcase_12 AC 376 ms
24,424 KB
testcase_13 AC 428 ms
23,432 KB
testcase_14 AC 736 ms
20,740 KB
testcase_15 AC 25 ms
10,880 KB
testcase_16 AC 32 ms
18,524 KB
testcase_17 AC 43 ms
19,000 KB
testcase_18 AC 50 ms
19,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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