結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,752 KB
testcase_01 AC 29 ms
10,752 KB
testcase_02 AC 29 ms
10,752 KB
testcase_03 AC 31 ms
10,752 KB
testcase_04 AC 29 ms
10,752 KB
testcase_05 AC 210 ms
24,508 KB
testcase_06 AC 3,113 ms
24,204 KB
testcase_07 AC 29 ms
10,752 KB
testcase_08 AC 38 ms
18,476 KB
testcase_09 AC 162 ms
18,536 KB
testcase_10 AC 420 ms
24,472 KB
testcase_11 AC 462 ms
24,428 KB
testcase_12 AC 431 ms
24,532 KB
testcase_13 AC 550 ms
23,344 KB
testcase_14 AC 784 ms
20,732 KB
testcase_15 AC 29 ms
10,880 KB
testcase_16 AC 38 ms
18,524 KB
testcase_17 AC 49 ms
18,920 KB
testcase_18 AC 59 ms
19,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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