結果

問題 No.390 最長の数列
ユーザー tookunn_1213tookunn_1213
提出日時 2016-07-09 18:28:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 204 ms / 5,000 ms
コード長 281 bytes
コンパイル時間 340 ms
コンパイル使用メモリ 82,320 KB
実行使用メモリ 99,636 KB
最終ジャッジ日時 2024-04-10 09:00:34
合計ジャッジ時間 2,265 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,140 KB
testcase_01 AC 35 ms
52,072 KB
testcase_02 AC 35 ms
52,732 KB
testcase_03 AC 35 ms
52,440 KB
testcase_04 AC 36 ms
52,312 KB
testcase_05 AC 82 ms
93,552 KB
testcase_06 AC 204 ms
98,652 KB
testcase_07 AC 37 ms
53,232 KB
testcase_08 AC 43 ms
60,952 KB
testcase_09 AC 47 ms
65,996 KB
testcase_10 AC 110 ms
99,360 KB
testcase_11 AC 107 ms
99,636 KB
testcase_12 AC 112 ms
99,236 KB
testcase_13 AC 78 ms
90,836 KB
testcase_14 AC 102 ms
91,424 KB
testcase_15 AC 35 ms
53,752 KB
testcase_16 AC 39 ms
60,220 KB
testcase_17 AC 54 ms
72,212 KB
testcase_18 AC 55 ms
73,100 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