結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,880 KB
testcase_01 AC 31 ms
10,880 KB
testcase_02 AC 30 ms
10,880 KB
testcase_03 AC 28 ms
10,752 KB
testcase_04 AC 28 ms
10,752 KB
testcase_05 AC 272 ms
24,192 KB
testcase_06 AC 3,089 ms
24,200 KB
testcase_07 AC 29 ms
10,752 KB
testcase_08 AC 162 ms
18,668 KB
testcase_09 AC 263 ms
18,720 KB
testcase_10 AC 506 ms
24,204 KB
testcase_11 AC 525 ms
24,196 KB
testcase_12 AC 489 ms
24,204 KB
testcase_13 AC 603 ms
23,368 KB
testcase_14 AC 763 ms
20,660 KB
testcase_15 AC 31 ms
10,880 KB
testcase_16 AC 154 ms
18,440 KB
testcase_17 AC 157 ms
18,888 KB
testcase_18 AC 168 ms
19,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
x = [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(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)
	ans = max(ans,dp[i])
print (ans)
0