結果

問題 No.390 最長の数列
ユーザー tookunn_1213tookunn_1213
提出日時 2016-07-09 18:32:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 199 ms / 5,000 ms
コード長 284 bytes
コンパイル時間 339 ms
コンパイル使用メモリ 82,428 KB
実行使用メモリ 94,080 KB
最終ジャッジ日時 2024-04-10 09:01:01
合計ジャッジ時間 2,460 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,148 KB
testcase_01 AC 36 ms
53,164 KB
testcase_02 AC 38 ms
51,956 KB
testcase_03 AC 36 ms
52,872 KB
testcase_04 AC 36 ms
53,144 KB
testcase_05 AC 81 ms
86,520 KB
testcase_06 AC 199 ms
92,800 KB
testcase_07 AC 37 ms
52,744 KB
testcase_08 AC 41 ms
59,840 KB
testcase_09 AC 47 ms
65,424 KB
testcase_10 AC 108 ms
93,744 KB
testcase_11 AC 106 ms
93,740 KB
testcase_12 AC 108 ms
94,080 KB
testcase_13 AC 80 ms
86,388 KB
testcase_14 AC 97 ms
85,096 KB
testcase_15 AC 36 ms
52,572 KB
testcase_16 AC 39 ms
60,012 KB
testcase_17 AC 54 ms
72,428 KB
testcase_18 AC 58 ms
74,060 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