結果

問題 No.390 最長の数列
ユーザー TawaraTawara
提出日時 2016-07-26 00:02:03
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 270 bytes
コンパイル時間 363 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 22,812 KB
最終ジャッジ日時 2024-04-24 09:27:56
合計ジャッジ時間 8,545 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 223 ms
14,156 KB
testcase_01 AC 196 ms
13,960 KB
testcase_02 AC 197 ms
14,080 KB
testcase_03 AC 224 ms
13,952 KB
testcase_04 AC 201 ms
14,024 KB
testcase_05 AC 215 ms
22,808 KB
testcase_06 AC 1,658 ms
22,680 KB
testcase_07 WA -
testcase_08 AC 126 ms
14,008 KB
testcase_09 AC 123 ms
14,080 KB
testcase_10 AC 386 ms
22,812 KB
testcase_11 AC 401 ms
22,680 KB
testcase_12 AC 390 ms
22,684 KB
testcase_13 AC 494 ms
20,848 KB
testcase_14 AC 1,689 ms
22,680 KB
testcase_15 AC 123 ms
14,144 KB
testcase_16 AC 124 ms
13,952 KB
testcase_17 AC 133 ms
14,336 KB
testcase_18 AC 137 ms
14,644 KB
権限があれば一括ダウンロードができます

ソースコード

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**6):
	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