結果

問題 No.390 最長の数列
ユーザー TawaraTawara
提出日時 2016-07-23 13:00:36
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 272 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 22,812 KB
最終ジャッジ日時 2024-04-24 07:40:15
合計ジャッジ時間 5,130 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 148 ms
14,208 KB
testcase_01 AC 121 ms
14,080 KB
testcase_02 AC 121 ms
13,952 KB
testcase_03 AC 146 ms
13,952 KB
testcase_04 AC 126 ms
14,080 KB
testcase_05 AC 104 ms
22,808 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 47 ms
14,080 KB
testcase_09 AC 45 ms
14,080 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 306 ms
20,976 KB
testcase_14 WA -
testcase_15 AC 46 ms
14,208 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

dp = [0]*(10**6+1)
N = int(raw_input())
for i in map(int,raw_input().split()):
	dp[i] = 1
for i in xrange(2,10**3+1):
	if dp[i] == 0:
		continue
	for j in xrange(i*2,10**6+1,i):
		if dp[j] == 0:
			continue
		if dp[i] + 1 > dp[j]:
			dp[j] = dp[i] + 1
print max(dp)+ dp[1]
0