結果

問題 No.390 最長の数列
ユーザー tookunn_1213tookunn_1213
提出日時 2016-07-09 18:27:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 194 ms / 5,000 ms
コード長 252 bytes
コンパイル時間 232 ms
コンパイル使用メモリ 82,312 KB
実行使用メモリ 99,076 KB
最終ジャッジ日時 2024-04-10 08:59:36
合計ジャッジ時間 2,330 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
52,532 KB
testcase_01 AC 35 ms
53,292 KB
testcase_02 AC 35 ms
53,008 KB
testcase_03 AC 35 ms
52,508 KB
testcase_04 AC 35 ms
52,540 KB
testcase_05 AC 87 ms
91,564 KB
testcase_06 AC 194 ms
98,444 KB
testcase_07 AC 36 ms
53,008 KB
testcase_08 AC 46 ms
65,416 KB
testcase_09 AC 45 ms
66,140 KB
testcase_10 AC 110 ms
98,808 KB
testcase_11 AC 111 ms
98,688 KB
testcase_12 AC 114 ms
99,076 KB
testcase_13 AC 80 ms
90,560 KB
testcase_14 AC 97 ms
90,404 KB
testcase_15 AC 37 ms
57,464 KB
testcase_16 AC 41 ms
65,288 KB
testcase_17 AC 56 ms
71,840 KB
testcase_18 AC 58 ms
72,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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